-
-
Save coderstrong/ffcd640b57e2db6b1d52f9d5c3f90da3 to your computer and use it in GitHub Desktop.
This is a sample commander CLI application used in Medium Article - How I automated my Job with Node JS
This file contains hidden or 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
| #! /usr/bin/env node | |
| const mason = require('commander'); | |
| const { version } = require('./package.json'); | |
| const console = require('console'); | |
| // commands | |
| const create = require('./commands/create'); | |
| const setup = require('./commands/setup'); | |
| mason | |
| .version(version); | |
| mason | |
| .command('setup [env]') | |
| .description('run setup commands for all envs') | |
| .action(setup); | |
| mason | |
| .command('create <ticketId>') | |
| .description('creates a new game') | |
| .action(create); | |
| mason | |
| .command('*') | |
| .action(() => { | |
| mason.help(); | |
| }); | |
| mason.parse(process.argv); | |
| if (!mason.args.length) { | |
| mason.help(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment