mirror of
https://github.com/status-im/js-waku-examples.git
synced 2025-01-11 22:44:32 +00:00
user commander to handle command
This commit is contained in:
parent
32ea01a135
commit
af0c0cf1b0
28
packages/create-waku-app/createWakuApp.js
Normal file
28
packages/create-waku-app/createWakuApp.js
Normal 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 };
|
Loading…
x
Reference in New Issue
Block a user