From 56f4890d2fb6d33a51e592164a8ddc613aaac774 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 14 Dec 2024 01:18:47 +0100 Subject: [PATCH 1/2] initial commit --- cli/parse_args.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cli/parse_args.ts b/cli/parse_args.ts index b6001a645c15..15b29591269a 100644 --- a/cli/parse_args.ts +++ b/cli/parse_args.ts @@ -9,7 +9,7 @@ * ```ts * import { parseArgs } from "@std/cli/parse-args"; * - * console.dir(parseArgs(Deno.args)); + * const args = parseArgs(Deno.args); * ``` * * @module @@ -282,10 +282,14 @@ export interface ParseOptions< * ```ts * // $ deno run example.ts -- a arg1 * import { parseArgs } from "@std/cli/parse-args"; - * console.dir(parseArgs(Deno.args, { "--": false })); - * // output: { _: [ "a", "arg1" ] } - * console.dir(parseArgs(Deno.args, { "--": true })); - * // output: { _: [], --: [ "a", "arg1" ] } + * const args = parseArgs(Deno.args, { "--": false }); // output: { _: [ "a", "arg1" ] } + * ``` + * + * @example + * ```ts + * // $ deno run example.ts -- a arg1 + * import { parseArgs } from "@std/cli/parse-args"; + * const args = parseArgs(Deno.args, { "--": true }); // output: { _: [], --: [ "a", "arg1" ] } * ``` */ "--"?: TDoubleDash; From f067755180efc4dafc9a6190844707d5029fc8bc Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 16 Dec 2024 17:44:43 +0900 Subject: [PATCH 2/2] modify --- cli/parse_args.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cli/parse_args.ts b/cli/parse_args.ts index 15b29591269a..ffbf59ce0aab 100644 --- a/cli/parse_args.ts +++ b/cli/parse_args.ts @@ -5,7 +5,7 @@ * Command line arguments parser based on * {@link https://github.com/minimistjs/minimist | minimist}. * - * @example + * @example Usage * ```ts * import { parseArgs } from "@std/cli/parse-args"; * @@ -278,18 +278,18 @@ export interface ParseOptions< * * @default {false} * - * @example + * @example Double dash option is false * ```ts * // $ deno run example.ts -- a arg1 * import { parseArgs } from "@std/cli/parse-args"; - * const args = parseArgs(Deno.args, { "--": false }); // output: { _: [ "a", "arg1" ] } + * const args = parseArgs(Deno.args, { "--": false }); // args equals { _: [ "a", "arg1" ] } * ``` * - * @example + * @example Double dash option is true * ```ts * // $ deno run example.ts -- a arg1 * import { parseArgs } from "@std/cli/parse-args"; - * const args = parseArgs(Deno.args, { "--": true }); // output: { _: [], --: [ "a", "arg1" ] } + * const args = parseArgs(Deno.args, { "--": true }); // args equals { _: [], --: [ "a", "arg1" ] } * ``` */ "--"?: TDoubleDash;