alexanderGugel / ied

:package: Like npm, but faster - an alternative package manager for Node
http://alexandergugel.github.io/ied
MIT License
1.99k stars 53 forks source link

Move to yargs. Autogenerates usage and fixes #12 #97

Closed STRML closed 8 years ago

STRML commented 8 years ago

This also adds the help command:

$ ied help
ied is a package manager for Node.

Usage:

ied <command> [arguments]

Commands:
  install [package]  Fetch all packages or an individual package
  run <command>      Run a package.json script
  test               Run the test script specified in the package.json
  shell              Enter a sub-shell with an augmented PATH
  ping               Check if the registry is up
  ls                 Print the dependency graph
  config             Print the current config
  init               Initialize a new package
  link [package]     Link the current package or into it
  unlink [package]   Unlink the current package or from it
  help [command]     View help on an individual command

Options:
  --version   Show version number                                              [boolean]
  -h, --help  Show usage information                                           [boolean]

README:  https://github.com/alexanderGugel/ied
ISSUES:  https://github.com/alexanderGugel/ied/issues
$ ied help install
ied install [package]

Options:
  --version       Show version number                                                                 [boolean]
  -h, --help      Show usage information                                                              [boolean]
  -S, --save      Update package.json dependencies                                                    [boolean]
  -D, --save-dev  Update package.json devDependencies                                                 [boolean]
  -o, --only      Install a subset of dependencies
  -r, --registry  Use a custom registry                                 [default: "https://registry.npmjs.org"]

Examples:
  ied install
  ied install <pkg>
  ied install <pkg>@<version>
  ied install <pkg>@<version range>
  ied install --only=production                                  Install dependencies only, not devDependencies
  ied install --registry="https://npm.mycorp.com" <pkg>              Install a package from your local registry
STRML commented 8 years ago

Force-pushed a lint fix

alexanderGugel commented 8 years ago

Not a big fan of dynamically generated docs TBH. Last time I tried yargs it had a massive dependency graph and required in like a hundred files. Will try this out...

STRML commented 8 years ago

This is going to give us a lot of flexibility in arg parsing, and ensures the docs always follow the code. It also fixes #12 because the existing argument parser has an issue with flag positioning.

If, in the future, something it autogenerates is no good, we can have it display a static file as part/all of the output.

It seems the dep tree is under control:

└─┬ yargs@4.4.0
  ├── cliui@3.1.2
  ├─┬ lodash.assign@4.0.7
  │ ├── lodash.keys@4.0.6
  │ └── lodash.rest@4.0.2
  ├─┬ pkg-conf@1.1.2
  │ ├── object-assign@4.0.1
  │ └── symbol@0.2.1
  ├── require-main-filename@1.0.1
  ├── window-size@0.2.0
  └─┬ yargs-parser@2.2.0
    ├── camelcase@2.1.1
    └─┬ lodash.assign@4.0.7
      └── lodash.keys@4.0.6
alexanderGugel commented 8 years ago

@STRML Ok, you convinced me :smile: If you submit this against rebirth (the next version of ied), I will merge. This might give you a bunch of merge conflicts TBH, but should be fairly easy to resolve. Let me know if I can help!

alexanderGugel commented 8 years ago

Closed for #110