Created
April 18, 2015 20:49
-
-
Save lcaballero/b799e2c3a758a59fed2c to your computer and use it in GitHub Desktop.
Example generating bash completions.
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
yargs = require 'yargs' | |
args = yargs | |
.options( | |
t: | |
alias: "tstuff" | |
description: "Does t stuff" | |
b: | |
alias: "batman" | |
description: "Bat-option" | |
h: | |
alias: "help" | |
description: "Show help" | |
s: | |
alias: "completions-script" | |
description: "Show completions script." | |
) | |
.command( | |
"generate", | |
(curr, argv) -> ["foo", "bar"] | |
) | |
.argv | |
if args.help | |
console.log(yargs.help()) | |
process.exit(1) | |
if args["completions-script"] | |
yargs.showCompletionScript() | |
process.exit(1) | |
console.log(args._) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment