summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNarendra Kamath G <narendrakamathg@gmail.com>2019-04-21 18:29:38 +0530
committerRyan Dahl <ry@tinyclouds.org>2019-04-21 08:59:38 -0400
commit14e74b209574aa599f730ae82d8393b41ac01476 (patch)
tree53783293972c69881826b228700bd4d35c1b6b4c
parentb06230027050c0bc797a5d47a5894dc53e25c8f5 (diff)
Docs: Added missing example in flags module - README.md (denoland/deno_std#348)
Original: https://github.com/denoland/deno_std/commit/289e1b110db44aedc3a6baf74feb015320399d1e
-rw-r--r--flags/README.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/flags/README.md b/flags/README.md
index cfd079b69..41692b619 100644
--- a/flags/README.md
+++ b/flags/README.md
@@ -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`.