1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

Docs: Added missing example in flags module - README.md (denoland/deno_std#348)

Original: 289e1b110d
This commit is contained in:
Narendra Kamath G 2019-04-21 18:29:38 +05:30 committed by Ryan Dahl
parent b062300270
commit 14e74b2095

View file

@ -55,6 +55,18 @@ options can be:
- `options['--']` - when true, populate `parsedArgs._` with everything before
the `--` and `parsedArgs['--']` with everything after the `--`. Here's an
example:
```ts
const { args } = Deno;
import { parse } from "https://deno.land/std/flags/mod.ts";
// options['--'] is now set to false
console.dir(parse(args, { "--": false }));
// $ deno example.ts -- a arg1
// output: { _: [ "example.ts", "a", "arg1" ] }
// options['--'] is now set to true
console.dir(parse(args, { "--": true }));
// $ deno example.ts -- a arg1
// output: { _: [ "example.ts" ], --: [ "a", "arg1" ] }
```
- `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`.