EasyEngine / cli-language-compare

Dummy project to compare different programming languages for a CLI project
1 stars 1 forks source link

Nodejs + commander #5

Closed rahul286 closed 7 years ago

rahul286 commented 9 years ago

https://github.com/tj/commander.js

rahul286 commented 9 years ago

Seems useful:

  1. https://www.npmjs.org/package/generator-commander
  2. https://www.npmjs.org/package/generator-node-cli
harshadyeola commented 9 years ago

Similar framework : https://github.com/flatiron/flatiron

rahul286 commented 9 years ago

Nodejs implements subcommand differently - https://github.com/tj/commander.js/issues/63#issuecomment-8944843

rahul286 commented 9 years ago

Posted PM style app here - https://github.com/rtCamp/cli/tree/nodepm

rahul286 commented 9 years ago

I have implemented multiple levels.

rahul286:cli/ (nodepm✗) $ ./index.js --help                          [20:22:33]

  Usage: index [options] [command]

  Commands:

    install [name]  install one or more packages
    search [query]  search with optional query
    list            list packages installed
    help [cmd]      display help for [cmd]

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

rahul286:cli/ (nodepm✗) $ ./index.js list --help                     [20:22:36]

  Usage: index-list [options] [command]

  Commands:

    foo         list packages installed
    help [cmd]  display help for [cmd]

  Options:

    -h, --help  output usage information
    -a, --all  hidden files listing

rahul286:cli/ (nodepm✗) $ ./index.js list foo --help                 [20:22:47]

  Usage: index-list-foo [options]

  Options:

    -h, --help  output usage information
harshadyeola commented 9 years ago

@rahul286 I will try to implement some ee commands, in the same way.

acrawly commented 7 years ago

I've found this no longer works.

Sparky:commander andrew$ node ee site create
fs.js:901
  return binding.lstat(pathModule._makeLong(path));
                 ^

Error: ENOENT: no such file or directory, lstat '/Users/andrew/Downloads/cli-master/nodejs/commander/ee-site'
    at fs.lstatSync (fs.js:901:18)
    at exports.readlinkSync (/Users/andrew/Downloads/cli-master/nodejs/commander/node_modules/graceful-readlink/index.js:5:7)
    at Command.executeSubCommand (/Users/andrew/Downloads/cli-master/nodejs/commander/node_modules/commander/index.js:503:14)
    at Command.parse (/Users/andrew/Downloads/cli-master/nodejs/commander/node_modules/commander/index.js:463:17)
    at Object.<anonymous> (/Users/andrew/Downloads/cli-master/nodejs/commander/ee-site.js:7:4)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
Sparky:commander andrew$ 
rahul286 commented 7 years ago

@acrawly this was a trial project. We were testing node.js.

In case you would like to use EasyEngine, please visit https://easyengine.io/ for instructions.

Otherwise, let us know how we can help you. :-)