From 14e74b209574aa599f730ae82d8393b41ac01476 Mon Sep 17 00:00:00 2001 From: Narendra Kamath G Date: Sun, 21 Apr 2019 18:29:38 +0530 Subject: Docs: Added missing example in flags module - README.md (denoland/deno_std#348) Original: https://github.com/denoland/deno_std/commit/289e1b110db44aedc3a6baf74feb015320399d1e --- flags/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'flags') 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`. -- cgit v1.2.3