4 Yargs be a node.js library fer hearties tryin' ter parse optstrings.
6 With yargs, ye be havin' a map that leads straight to yer treasure! Treasure of course, being a simple option hash.
8 [![Build Status][travis-image]][travis-url]
9 [![Dependency Status][gemnasium-image]][gemnasium-url]
10 [![Coverage Status][coveralls-image]][coveralls-url]
11 [![NPM version][npm-image]][npm-url]
12 [![Windows Tests][windows-image]][windows-url]
14 > Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/bcoe/yargs/issues) :)
19 With yargs, the options be just a hash!
20 -------------------------------------------------------------------
26 var argv = require('yargs').argv;
28 if (argv.ships > 3 && argv.distance < 53.5) {
29 console.log('Plunder more riffiwobbles!');
32 console.log('Retreat from the xupptumblers!');
38 $ ./plunder.js --ships=4 --distance=22
39 Plunder more riffiwobbles!
41 $ ./plunder.js --ships 12 --distance 98.7
42 Retreat from the xupptumblers!
44 ![Joe was one optimistic pirate.](http://i.imgur.com/4WFGVJ9.png)
46 But don't walk the plank just yet! There be more! You can do short options:
47 -------------------------------------------------
53 var argv = require('yargs').argv;
54 console.log('(%d,%d)', argv.x, argv.y);
59 $ ./short.js -x 10 -y 21
62 And booleans, both long, short, and even grouped:
63 ----------------------------------
69 var argv = require('yargs').argv;
72 process.stdout.write(argv.fr ? 'Le perroquet dit: ' : 'The parrot says: ');
75 (argv.fr ? 'couac' : 'squawk') + (argv.p ? '!' : '')
82 The parrot says: squawk
85 The parrot says: squawk!
88 Le perroquet dit: couac!
90 And non-hyphenated options too! Just use `argv._`!
91 -------------------------------------------------
97 var argv = require('yargs').argv;
98 console.log('(%d,%d)', argv.x, argv.y);
104 $ ./nonopt.js -x 6.82 -y 3.35 rum
108 $ ./nonopt.js "me hearties" -x 0.54 yo -y 1.12 ho
110 [ 'me hearties', 'yo', 'ho' ]
112 Yargs even counts your booleans!
113 ----------------------------------------------------------------------
119 var argv = require('yargs')
121 .alias('v', 'verbose')
124 VERBOSE_LEVEL = argv.verbose;
126 function WARN() { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); }
127 function INFO() { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); }
128 function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); }
130 WARN("Showing only important stuff");
131 INFO("Showing semi-important stuff too");
132 DEBUG("Extra chatty mode");
137 Showing only important stuff
140 Showing only important stuff
141 Showing semi-important stuff too
144 Showing only important stuff
145 Showing semi-important stuff too
148 $ node count.js -v --verbose
149 Showing only important stuff
150 Showing semi-important stuff too
153 Tell users how to use yer options and make demands.
154 -------------------------------------------------
160 var argv = require('yargs')
161 .usage('Usage: $0 -w [num] -h [num]')
165 console.log("The area is:", argv.w * argv.h);
170 $ ./area.js -w 55 -h 11
173 $ node ./area.js -w 4.91 -w 2.51
174 Usage: area.js -w [num] -h [num]
180 Missing required arguments: h
182 After yer demands have been met, demand more! Ask for non-hyphenated arguments!
183 -----------------------------------------
189 var argv = require('yargs')
197 $ ./demand_count.js a
199 Not enough non-option arguments: got 1, need at least 2
201 $ ./demand_count.js a b
202 { _: [ 'a', 'b' ], '$0': 'demand_count.js' }
204 $ ./demand_count.js a b c
205 { _: [ 'a', 'b', 'c' ], '$0': 'demand_count.js' }
207 EVEN MORE SHIVER ME TIMBERS!
214 var argv = require('yargs')
219 console.log(argv.x + argv.y);
224 $ ./default_singles.js -x 5
231 var argv = require('yargs')
232 .default({ x : 10, y : 10 })
235 console.log(argv.x + argv.y);
240 $ ./default_hash.js -y 7
243 And if you really want to get all descriptive about it...
244 ---------------------------------------------------------
250 var argv = require('yargs')
260 $ ./boolean_single.js -v "me hearties" yo ho
262 [ 'me hearties', 'yo', 'ho' ]
269 var argv = require('yargs')
270 .boolean(['x','y','z'])
273 console.dir([ argv.x, argv.y, argv.z ]);
279 $ ./boolean_double.js -x -z one two three
280 [ true, false, true ]
281 [ 'one', 'two', 'three' ]
283 Yargs is here to help you...
284 ---------------------------
286 Ye can describe parameters fer help messages and set aliases. Yargs figures
287 out how ter format a handy help string automatically.
293 var argv = require('yargs')
294 .usage('Usage: $0 <command> [options]')
295 .command('count', 'Count the lines in a file')
297 .example('$0 count -f foo.js', 'count the lines in the given file')
301 .describe('f', 'Load a file')
304 .epilog('copyright 2015')
307 var fs = require('fs');
308 var s = fs.createReadStream(argv.file);
311 s.on('data', function (buf) {
312 lines += buf.toString().match(/\n/g).length;
315 s.on('end', function () {
321 $ node line_count.js count
322 Usage: line_count.js <command> [options]
325 count Count the lines in a file
328 -f, --file Load a file [required]
329 -h, --help Show help [boolean]
332 line_count.js count -f foo.js count the lines in the given file
336 Missing required arguments: f
338 $ node line_count.js count --file line_count.js
341 $ node line_count.js count -f line_count.js
350 require('yargs').argv
353 will use the `process.argv` array to construct the `argv` object.
355 You can pass in the `process.argv` yourself:
358 require('yargs')([ '-x', '1', '-y', '2' ]).argv
361 or use `.parse()` to do the same thing:
364 require('yargs').parse([ '-x', '1', '-y', '2' ])
367 The rest of these methods below come in just before the terminating `.argv`.
369 <a name="alias"></a>.alias(key, alias)
372 Set key names as equivalent such that updates to a key will propagate to aliases
375 Optionally `.alias()` can take an object that maps keys to aliases.
376 Each key of this object should be the canonical version of the option, and each
377 value should be a string or an array of strings.
382 Get the arguments as a plain old object.
384 Arguments without a corresponding flag show up in the `argv._` array.
386 The script name or node command is available at `argv.$0` similarly to how `$0`
387 works in bash or perl.
389 If `yargs` is executed in an environment that embeds node and there's no script name (e.g.
390 [Electron](http://electron.atom.io/) or [nw.js](http://nwjs.io/)), it will ignore the first parameter since it
391 expects it to be the script name. In order to override this behavior, use `.parse(process.argv.slice(1))`
392 instead of `.argv` and the first parameter won't be ignored.
394 <a name="array"></a>.array(key)
397 Tell the parser to interpret `key` as an array. If `.array('foo')` is set,
398 `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`.
400 <a name="boolean"></a>.boolean(key)
403 Interpret `key` as a boolean. If a non-flag option follows `key` in
404 `process.argv`, that string won't get set as the value of `key`.
406 `key` will default to `false`, unless a `default(key, undefined)` is
409 If `key` is an array, interpret all the elements as booleans.
414 Check that certain conditions are met in the provided arguments.
416 `fn` is called with two arguments, the parsed `argv` hash and an array of options and their aliases.
418 If `fn` throws or returns a non-truthy value, show the thrown error, usage information, and
421 <a name="choices"></a>.choices(key, choices)
422 ----------------------
424 Limit valid values for `key` to a predefined set of `choices`, given as an array
425 or as an individual value.
428 var argv = require('yargs')
429 .alias('i', 'ingredient')
430 .describe('i', 'choose your sandwich ingredients')
431 .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles'])
436 If this method is called multiple times, all enumerated values will be merged
437 together. Choices are generally strings or numbers, and value matching is
440 Optionally `.choices()` can take an object that maps multiple keys to their
443 Choices can also be specified as `choices` in the object given to `option()`.
446 var argv = require('yargs')
449 describe: 'choose a size',
450 choices: ['xs', 's', 'm', 'l', 'xl']
455 .command(cmd, desc, [fn])
458 Document the commands exposed by your application.
460 Use `desc` to provide a description for each command your application accepts (the
461 values stored in `argv._`). Set `desc` to `false` to create a hidden command.
462 Hidden commands don't show up in the help output and aren't available for
465 Optionally, you can provide a handler `fn` which will be executed when
466 a given command is provided. The handler will be called with `yargs` and
469 `yargs` is a blank instance of yargs, which can be used to compose a nested
470 hierarchy of options handlers.
472 `argv` represents the arguments parsed prior to the
473 command being executed (those described in the outer yargs instance).
475 Here's an example of top-level and nested commands in action:
478 var argv = require('yargs')
479 .usage('npm <command>')
480 .command('install', 'tis a mighty fine package to install')
481 .command('publish', 'shiver me timbers, should you be sharing all that', function (yargs, argv) {
482 argv = yargs.option('f', {
484 description: 'yar, it usually be a bad idea'
493 .completion(cmd, [description], [fn]);
496 Enable bash-completion shortcuts for commands and options.
498 `cmd`: When present in `argv._`, will result in the `.bashrc` completion script
499 being outputted. To enable bash completions, concat the generated script to your
500 `.bashrc` or `.bash_profile`.
502 `description`: Provide a description in your usage instructions for the command
503 that generates bash completion scripts.
505 `fn`: Rather than relying on yargs' default completion functionality, which
506 shiver me timbers is pretty awesome, you can provide your own completion
510 var argv = require('yargs')
511 .completion('completion', function(current, argv) {
512 // 'current' is the current command being completed.
513 // 'argv' is the parsed arguments so far.
514 // simply return an array of completions.
523 You can also provide asynchronous completions.
526 var argv = require('yargs')
527 .completion('completion', function(current, argv, done) {
528 setTimeout(function() {
538 But wait, there's more! You can return an asynchronous promise.
541 var argv = require('yargs')
542 .completion('completion', function(current, argv, done) {
543 return new Promise(function (resolve, reject) {
544 setTimeout(function () {
545 resolve(['apple', 'banana'])
552 <a name="config"></a>.config(key, [description], [parseFn])
555 Tells the parser that if the option specified by `key` is passed in, it
556 should be interpreted as a path to a JSON config file. The file is loaded
557 and parsed, and its properties are set as arguments.
559 An optional `description` can be provided to customize the config (`key`) option
562 An optional `parseFn` can be used to provide a custom parser. The parsing
563 function must be synchronous, and should return an object containing
564 key value pairs or an error.
567 var argv = require('yargs')
568 .config('settings', function (configPath) {
569 return JSON.parse(fs.readFileSync(configPath, 'utf-8'))
574 <a name="count"></a>.count(key)
577 Interpret `key` as a boolean flag, but set its parsed value to the number of
578 flag occurrences rather than `true` or `false`. Default value is thus `0`.
580 <a name="default"></a>.default(key, value, [description])
583 Set `argv[key]` to `value` if no option was specified in `process.argv`.
585 Optionally `.default()` can take an object that maps keys to default values.
587 But wait, there's more! The default value can be a `function` which returns
588 a value. The name of the function will be used in the usage string:
591 var argv = require('yargs')
592 .default('random', function randomValue() {
593 return Math.random() * 256;
597 Optionally, `description` can also be provided and will take precedence over
598 displaying the value in the usage instructions:
601 .default('timeout', 60000, '(one-minute)')
604 <a name="demand"></a>.demand(key, [msg | boolean])
605 ------------------------------
606 .demand(count, [max], [msg])
607 ------------------------------
609 If `key` is a string, show the usage information and exit if `key` wasn't
610 specified in `process.argv`.
612 If `key` is a number, demand at least as many non-option arguments, which show
613 up in `argv._`. A second number can also optionally be provided, which indicates
614 the maximum number of non-option arguments.
616 If `key` is an array, demand each element.
618 If a `msg` string is given, it will be printed when the argument is missing,
619 instead of the standard error message. This is especially helpful for the non-option arguments in `argv._`.
621 If a `boolean` value is given, it controls whether the option is demanded;
622 this is useful when using `.options()` to specify command line parameters.
624 <a name="describe"></a>.describe(key, desc)
627 Describe a `key` for the generated usage information.
629 Optionally `.describe()` can take an object that maps keys to descriptions.
631 .detectLocale(boolean)
634 Should yargs attempt to detect the os' locale? Defaults to `true`.
639 Tell yargs to parse environment variables matching the given prefix and apply
640 them to argv as though they were command line arguments.
642 If this method is called with no argument or with an empty string or with `true`,
643 then all env vars will be applied to argv.
645 Program arguments are defined in this order of precedence:
650 4. Configured defaults
653 var argv = require('yargs')
656 alias: 'fruit-thing',
667 'fruit-thing': 'apple',
673 $ MY_PROGRAM_FRUIT_THING=banana node fruity.js
675 fruitThing: 'banana',
677 'fruit-thing': 'banana',
682 $ MY_PROGRAM_FRUIT_THING=banana node fruity.js -f cat
685 'fruit-thing': 'cat',
690 Env var parsing is disabled by default, but you can also explicitly disable it
691 by calling `.env(false)`, e.g. if you need to undo previous configuration.
698 A message to print at the end of the usage instructions, e.g.
701 var argv = require('yargs')
702 .epilogue('for more information, find our manual at http://example.com');
708 Give some example invocations of your program. Inside `cmd`, the string
709 `$0` will get interpolated to the current script name or node command for the
710 present script similar to how `$0` works in bash or perl.
711 Examples will be printed out as part of the help message.
714 ----------------------------------
716 By default, yargs exits the process when the user passes a help flag, uses the
717 `.version` functionality, or when validation fails. Calling
718 `.exitProcess(false)` disables this behavior, enabling further actions after
719 yargs have been validated.
724 Method to execute when a failure occurs, rather than printing the failure message.
726 `fn` is called with the failure message that would have been printed.
728 <a name="group"></a>.group(key(s), groupName)
731 Given a key, or an array of keys, places options under an alternative heading
732 when displaying usage instructions, e.g.,
735 var yargs = require('yargs')(['--help'])
737 .group('batman', 'Heroes:')
738 .describe('batman', "world's greatest detective")
744 --batman world's greatest detective
747 --help Show help [boolean]
749 .help([option, [description]])
750 ------------------------------
752 Add an option (e.g. `--help`) that displays the usage string and exits the
753 process. If present, the `description` parameter customizes the description of
754 the help option in the usage string.
756 If invoked without parameters, `.help()` returns the generated usage string.
761 var yargs = require("yargs")
762 .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
763 console.log(yargs.help());
766 Later on, `argv` can be retrieved with `yargs.argv`.
771 Given the key `x` is set, it is required that the key `y` is set.
773 Optionally `.implies()` can accept an object specifying multiple implications.
778 Return the locale that yargs is currently using.
780 By default, yargs will auto-detect the operating system's locale so that
781 yargs-generated help content will display in the user's language.
783 To override this behavior with a static locale, pass the desired locale as a
784 string to this method (see below).
789 Override the auto-detected locale from the user's operating system with a static
790 locale. Note that the OS locale can be modified by setting/exporting the `LC_ALL`
791 environment variable.
794 var argv = require('yargs')
795 .usage('./$0 - follow ye instructions true')
798 describe: "'tis a mighty fine option",
801 .command('run', "Arrr, ya best be knowin' what yer doin'")
802 .example('$0 run foo', "shiver me timbers, here's an example for ye")
812 ./test.js - follow ye instructions true
815 run Arrr, ya best be knowin' what yer doin'
817 Options for me hearties!
818 --option, -o 'tis a mighty fine option [requi-yar-ed]
819 --help Parlay this here code of conduct [boolean]
822 test.js run foo shiver me timbers, here's an example for ye
824 Ye be havin' to set the followin' argument land lubber: option
827 Locales currently supported:
830 * **en:** American English.
833 * **id:** Indonesian.
836 * **nb:** Norwegian Bokmål.
837 * **pirate:** American Pirate.
838 * **pt:** Portuguese.
839 * **pt_BR:** Brazilian Portuguese.
843 To submit a new translation for yargs:
845 1. use `./locales/en.json` as a starting point.
846 2. submit a pull request with the new locale file.
848 *The [Microsoft Terminology Search](http://www.microsoft.com/Language/en-US/Search.aspx) can be useful for finding the correct terminology in your locale.*
850 <a name="nargs"></a>.nargs(key, count)
853 The number of arguments that should be consumed after a key. This can be a
854 useful hint to prevent parsing ambiguity. For example:
857 var argv = require('yargs')
859 .parse(['--token', '-my-token']);
864 `{ _: [], token: '-my-token', '$0': 'node test' }`
866 Optionally `.nargs()` can take an object of `key`/`narg` pairs.
873 Instead of chaining together `.alias().demand().default().describe().string()`, you can specify
874 keys in `opt` for each of the chainable methods.
879 var argv = require('yargs')
883 default: '/etc/passwd',
884 describe: 'x marks the spot',
894 var argv = require('yargs')
897 .default('f', '/etc/passwd')
898 .describe('f', 'x marks the spot')
904 Optionally `.options()` can take an object that maps keys to `opt` parameters.
907 var argv = require('yargs')
912 default: '/etc/passwd',
913 describe: 'x marks the spot',
921 Valid `opt` keys include:
923 - `alias`: string or array of strings, alias(es) for the canonical option key, see [`alias()`](#alias)
924 - `array`: boolean, interpret option as an array, see [`array()`](#array)
925 - `boolean`: boolean, interpret option as a boolean flag, see [`boolean()`](#boolean)
926 - `choices`: value or array of values, limit valid option arguments to a predefined set, see [`choices()`](#choices)
927 - `config`: boolean, interpret option as a path to a JSON config file, see [`config()`](#config)
928 - `configParser`: function, provide a custom config parsing function, see [`config()`](#config)
929 - `count`: boolean, interpret option as a count of boolean flags, see [`count()`](#count)
930 - `default`: value, set a default value for the option, see [`default()`](#default)
931 - `defaultDescription`: string, use this description for the default value in help content, see [`default()`](#default)
932 - `demand`/`require`/`required`: boolean or string, demand the option be given, with optional error message, see [`demand()`](#demand)
933 - `desc`/`describe`/`description`: string, the option description for help content, see [`describe()`](#describe)
934 - `group`: string, when displaying usage instructions place the option under an alternative group heading, see [`group()`](#group)
935 - `nargs`: number, specify how many arguments should be consumed for the option, see [`nargs()`](#nargs)
936 - `requiresArg`: boolean, require the option be specified with a value, see [`requiresArg()`](#requiresArg)
937 - `string`: boolean, interpret option as a string, see [`string()`](#string)
938 - `type`: one of the following strings
939 - `'array'`: synonymous for `array: true`, see [`array()`](#array)
940 - `'boolean'`: synonymous for `boolean: true`, see [`boolean()`](#boolean)
941 - `'count'`: synonymous for `count: true`, see [`count()`](#count)
942 - `'string'`: synonymous for `string: true`, see [`string()`](#string)
947 Parse `args` instead of `process.argv`. Returns the `argv` object.
949 `args` may either be a pre-processed argv array, or a raw argument string.
951 .require(key, [msg | boolean])
952 ------------------------------
953 .required(key, [msg | boolean])
954 ------------------------------
956 An alias for [`demand()`](#demand). See docs there.
958 <a name="requiresArg"></a>.requiresArg(key)
961 Specifies either a single option key (string), or an array of options that
962 must be followed by option values. If any option value is missing, show the
963 usage information and exit.
965 The default behavior is to set the value of any key not followed by an
966 option value to `true`.
971 Reset the argument object built up so far. This is useful for
972 creating nested command line interfaces.
975 var yargs = require('yargs')
977 .command('hello', 'hello command')
978 .command('world', 'world command')
979 .demand(1, 'must provide a valid command'),
983 if (command === 'hello') {
987 .example('$0 hello', 'print the hello message!')
990 console.log('hello!');
991 } else if (command === 'world'){
995 .example('$0 world', 'print the world message!')
998 console.log('world!');
1004 .showCompletionScript()
1005 ----------------------
1007 Generate a bash completion script. Users of your application can install this
1008 script in their `.bashrc`, and yargs will provide completion shortcuts for
1009 commands and options.
1011 .showHelp(consoleLevel='error')
1012 ---------------------------
1014 Print the usage data using the [`console`](https://nodejs.org/api/console.html) function `consoleLevel` for printing.
1019 var yargs = require("yargs")
1020 .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
1021 yargs.showHelp(); //prints to stderr using console.error()
1024 Or, to print the usage data to `stdout` instead, you can specify the use of `console.log`:
1027 yargs.showHelp("log"); //prints to stdout using console.log()
1030 Later on, `argv` can be retrieved with `yargs.argv`.
1032 .showHelpOnFail(enable, [message])
1033 ----------------------------------
1035 By default, yargs outputs a usage string if any error is detected. Use the
1036 `.showHelpOnFail()` method to customize this behavior. If `enable` is `false`,
1037 the usage string is not output. If the `message` parameter is present, this
1038 message is output after the error message.
1044 var argv = require('yargs')
1045 .usage('Count the lines in a file.\nUsage: $0 -f <file>')
1048 .describe('f', 'Load a file')
1050 .showHelpOnFail(false, 'Specify --help for available options')
1060 $ node line_count.js
1061 Missing argument value: f
1063 Specify --help for available options
1069 Any command-line argument given that is not demanded, or does not have a
1070 corresponding description, will be reported as an error.
1072 <a name="string"></a>.string(key)
1075 Tell the parser logic not to interpret `key` as a number or boolean.
1076 This can be useful if you need to preserve leading zeros in an input.
1078 If `key` is an array, interpret all the elements as strings.
1080 `.string('_')` will result in non-hyphenated arguments being interpreted as strings,
1081 regardless of whether they resemble numbers.
1088 Override the default strings used by yargs with the key/value
1089 pairs provided in `obj`:
1092 var argv = require('yargs')
1093 .command('run', 'the run command')
1096 'Commands:': 'My Commands -->\n'
1110 --help Show help [boolean]
1113 If you explicitly specify a `locale()`, you should do so *before* calling
1116 .usage(message, [opts])
1117 ---------------------
1119 Set a usage message to show which commands to use. Inside `message`, the string
1120 `$0` will get interpolated to the current script name or node command for the
1121 present script similar to how `$0` works in bash or perl.
1123 `opts` is optional and acts like calling `.options(opts)`.
1125 .version(version, [option], [description])
1126 ----------------------------------------
1128 Add an option (e.g. `--version`) that displays the version number (given by the
1129 `version` parameter) and exits the process. If present, the `description`
1130 parameter customizes the description of the version option in the usage string.
1132 You can provide a `function` for version, rather than a string.
1133 This is useful if you want to use the version from your package.json:
1136 var argv = require('yargs')
1137 .version(function() {
1138 return require('../package').version;
1146 Format usage output to wrap at `columns` many columns.
1148 By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to
1149 specify no column limit (no right-align). Use `.wrap(yargs.terminalWidth())` to
1150 maximize the width of yargs' usage instructions.
1158 Use `--` to stop parsing flags and stuff the remainder into `argv._`.
1160 $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4
1161 { _: [ '-c', '3', '-d', '4' ],
1164 '$0': 'examples/reflect.js' }
1169 If you want to explicitly set a field to false instead of just leaving it
1170 undefined or to override a default you can do `--no-key`.
1172 $ node examples/reflect.js -a --no-b
1173 { _: [], a: true, b: false, '$0': 'examples/reflect.js' }
1178 Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to
1179 one. This way you can just `net.createConnection(argv.port)` and you can add
1180 numbers out of `argv` with `+` without having that mean concatenation,
1181 which is super frustrating.
1186 If you specify a flag multiple times it will get turned into an array containing
1187 all the values in order.
1189 $ node examples/reflect.js -x 5 -x 8 -x 0
1190 { _: [], x: [ 5, 8, 0 ], '$0': 'examples/reflect.js' }
1195 When you use dots (`.`s) in argument names, an implicit object path is assumed.
1196 This lets you organize arguments into nested objects.
1198 $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5
1200 foo: { bar: { baz: 33 }, quux: 5 },
1201 '$0': 'examples/reflect.js' }
1206 Short numeric `-n5` style arguments work too:
1208 $ node examples/reflect.js -n123 -m456
1209 { _: [], n: 123, m: 456, '$0': 'examples/reflect.js' }
1214 With [npm](https://github.com/npm/npm), just do:
1218 or clone this project on github:
1220 git clone http://github.com/bcoe/yargs.git
1222 To run the tests with npm, just do:
1229 This module is loosely inspired by Perl's
1230 [Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm).
1234 [travis-url]: https://travis-ci.org/bcoe/yargs
1235 [travis-image]: https://img.shields.io/travis/bcoe/yargs.svg
1236 [gemnasium-url]: https://gemnasium.com/bcoe/yargs
1237 [gemnasium-image]: https://img.shields.io/gemnasium/bcoe/yargs.svg
1238 [coveralls-url]: https://coveralls.io/github/bcoe/yargs
1239 [coveralls-image]: https://img.shields.io/coveralls/bcoe/yargs.svg
1240 [npm-url]: https://www.npmjs.com/package/yargs
1241 [npm-image]: https://img.shields.io/npm/v/yargs.svg
1242 [windows-url]: https://ci.appveyor.com/project/bcoe/yargs
1243 [windows-image]: https://img.shields.io/appveyor/ci/bcoe/yargs/master.svg?label=Windows%20Tests