Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .example + .examples sub command (#60) #63

Merged
merged 5 commits into from
Mar 15, 2017
Merged

Conversation

ntwcklng
Copy link
Collaborator

@ntwcklng ntwcklng commented Feb 25, 2017

Example file:

const args = require('./')

args
.option('deploy', 'deploy')
.option(['D', 'deps'], 'dependencies')
.example('usage 1', 'desc 1')
.examples([
  {usage: 'usage 2', description: 'desc 2'},
  {usage: 'usage 3', description: 'desc 3'},
  {usage: 'usage 4', description: 'desc 4'},
  {usage: 'usage 5', description: 'desc 5'}
])

args.parse(process.argv)

output:


  Usage: example.js [options] [command]

  Commands:

    help  Display help

  Options:

    -d, --deploy   deploy
    -D, --deps     dependencies
    -h, --help     Output usage information
    -v, --version  Output the version number

  Examples:

    usage 1  desc 1
    usage 2  desc 2
    usage 3  desc 3
    usage 4  desc 4
    usage 5  desc 5

@ntwcklng
Copy link
Collaborator Author

Do you want the output to be the same as now -h examples?
e.g.

- description 1
$ usage 1

- description 2
$ usage 2

...

@ntwcklng ntwcklng changed the title #60 .example + readme Add .example + .examples sub command (#60) Feb 25, 2017
@leo
Copy link
Owner

leo commented Feb 25, 2017

@ntwcklng Yes! 😊 Don't forget the colors, the newlines between description and usage and the indentation.

@ntwcklng
Copy link
Collaborator Author

ntwcklng commented Feb 25, 2017

screenshot at feb 25 22-26-42

Should we include the $ by default in the usage example?

edit: indentation is fixed in 633ba9a

@leo
Copy link
Owner

leo commented Mar 15, 2017

Sweet! Thanks 😊

@leo leo merged commit 44d9b6a into leo:master Mar 15, 2017
@ntwcklng ntwcklng deleted the examples branch April 14, 2017 08:05
leo pushed a commit that referenced this pull request May 1, 2022
* .example + readme

* now -h example style

* align identation

* update print methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants