-
-
Save steevehook/da53bbe8ba8e11cb4f666dd635769914 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 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