diff options
Diffstat (limited to 'flags/README.md')
| -rw-r--r-- | flags/README.md | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/flags/README.md b/flags/README.md index 4afda374c..9d09a2210 100644 --- a/flags/README.md +++ b/flags/README.md @@ -4,7 +4,7 @@ Command line arguments parser for Deno based on minimist # Example -``` ts +```ts import { args } from "deno"; import { parse } from "https://deno.land/x/flags/index.ts"; @@ -32,8 +32,8 @@ $ deno example.ts -x 3 -y 4 -n5 -abc --beep=boop foo bar baz ## const parsedArgs = parse(args, options = {}); -`parsedArgs._` contains all the arguments that didn't have an option associated with -them. +`parsedArgs._` contains all the arguments that didn't have an option associated +with them. Numeric-looking arguments will be returned as numbers unless `options.string` or `options.boolean` is set for that argument name. @@ -42,18 +42,19 @@ Any arguments after `'--'` will not be parsed and will end up in `parsedArgs._`. options can be: -* `options.string` - a string or array of strings argument names to always treat as -strings -* `options.boolean` - a boolean, string or array of strings to always treat as -booleans. if `true` will treat all double hyphenated arguments without equal signs -as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) -* `options.alias` - an object mapping string names to strings or arrays of string -argument names to use as aliases -* `options.default` - an object mapping string argument names to default values -* `options.stopEarly` - when true, populate `parsedArgs._` with everything after the -first non-option -* `options['--']` - when true, populate `parsedArgs._` with everything before the `--` -and `parsedArgs['--']` with everything after the `--`. Here's an example: -* `options.unknown` - a function which is invoked with a command line parameter not -defined in the `options` configuration object. If the function returns `false`, the -unknown option is not added to `parsedArgs`. +- `options.string` - a string or array of strings argument names to always treat + as strings +- `options.boolean` - a boolean, string or array of strings to always treat as + booleans. if `true` will treat all double hyphenated arguments without equal + signs as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +- `options.alias` - an object mapping string names to strings or arrays of + string argument names to use as aliases +- `options.default` - an object mapping string argument names to default values +- `options.stopEarly` - when true, populate `parsedArgs._` with everything after + the first non-option +- `options['--']` - when true, populate `parsedArgs._` with everything before + the `--` and `parsedArgs['--']` with everything after the `--`. Here's an + example: +- `options.unknown` - a function which is invoked with a command line parameter + not defined in the `options` configuration object. If the function returns + `false`, the unknown option is not added to `parsedArgs`. |
