user commander to handle command

This commit is contained in:
weboko 2022-12-05 20:34:44 +01:00 committed by weboko
parent 32ea01a135
commit af0c0cf1b0
No known key found for this signature in database
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
const { Command } = require('commander');
const packageJson = require('./package.json');
let appName;
const createApp = () => {
const program = new Command()
.name(packageJson.name)
.description(packageJson.description)
.version(packageJson.version)
.arguments("<project-directory>", "Project directory to initialize Waku app")
.action(name => {
appName = name;
})
.option(
"-t, --template <path-to-template>",
"specify a template for the created project"
)
.allowUnknownOption()
.parse();
const options = program.opts();
console.log(`Initializing ${appName} from template ${options.template || "default"}`);
};
module.exports = { createApp };