-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
322a046
commit 6f8af46
Showing
5 changed files
with
81 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env node | ||
import { resolve, dirname } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
import { Command } from 'commander'; | ||
import fsExtra from 'fs-extra'; | ||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
const { readJsonSync } = fsExtra; | ||
const packageInfo = readJsonSync(resolve(__dirname, 'package.json')); | ||
const program = new Command(); | ||
|
||
program | ||
.alias('ge') | ||
.description(packageInfo.description) | ||
.argument('<data-file...>', 'data file used to fill the document') | ||
.requiredOption( | ||
'-t, --template <file>', | ||
'template file used to render the document' | ||
) | ||
.option('-o, --output <file>', 'output file') | ||
.version(packageInfo.version) | ||
.addHelpText( | ||
'after', | ||
` | ||
Examples: | ||
$ geneasy -t template.hbs -o README.md readme.json | ||
$ geneasy -t template.hbs -o index.html data.yaml | ||
$ ge -t template.hbs -o /list/index.html data.yaml` | ||
) | ||
.showHelpAfterError(); | ||
|
||
program.parse(); | ||
// Program.parse(process.argv); | ||
|
||
const options = program.opts(); | ||
if (options.template) console.log(`- template: ${options.template}`); | ||
if (options.output) console.log(`- output: ${options.output}`); | ||
console.log('Remaining arguments:', program.args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export default { | ||
register: function () {} | ||
function register() {} | ||
const geneasy = { | ||
register | ||
}; | ||
export default geneasy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters