From 57a127f5f6e06db1fbd08f18a027745169ddac9a Mon Sep 17 00:00:00 2001 From: Alexander Gorham <124462074+SuperHeavyBallet@users.noreply.github.com> Date: Wed, 29 Oct 2025 11:28:19 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Clarify=20placeholder=20usage=20(=E2=80=98f?= =?UTF-8?q?oo=E2=80=99/=E2=80=98bar=E2=80=99)=20in=20CLI=20flag=20document?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The documentation for command-line flags uses “foo” and “bar” as placeholders without clarifying that they are generic examples of a key and a value. New readers unfamiliar with this convention may interpret them as literal parameters. Suggest adding a short note explaining that “foo/bar” are placeholders for any config key/value. --- content/cli/v11/using-npm/config.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/cli/v11/using-npm/config.mdx b/content/cli/v11/using-npm/config.mdx index 1c029681417..8428a38af80 100644 --- a/content/cli/v11/using-npm/config.mdx +++ b/content/cli/v11/using-npm/config.mdx @@ -25,6 +25,8 @@ npm gets its configuration values from the following sources, sorted by priority #### Command Line Flags +_**Note:** In this document `foo` and `bar` are used as placeholders to represent generic examples of parameter names and values. They are not literal parameters._ + Putting `--foo bar` on the command line sets the `foo` configuration parameter to `"bar"`. A `--` argument tells the cli parser to stop reading flags. Using `--flag` without specifying any value will set the value to `true`. Example: `--flag1 --flag2` will set both configuration parameters to `true`, while `--flag1 --flag2 bar` will set `flag1` to `true`, and `flag2` to `bar`. Finally, `--flag1 --flag2 -- bar` will set both configuration parameters to `true`, and the `bar` is taken as a command argument. From a9ebd1cf53703fd4de98e5c874ccdafe96af23d1 Mon Sep 17 00:00:00 2001 From: Alexander Gorham <124462074+SuperHeavyBallet@users.noreply.github.com> Date: Wed, 29 Oct 2025 12:53:15 +0100 Subject: [PATCH 2/3] Config > Command Line Flags Rewrite A more comprehensive rewrite of this section that builds on the prior clarification. --- content/cli/v11/using-npm/config.mdx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/content/cli/v11/using-npm/config.mdx b/content/cli/v11/using-npm/config.mdx index 8428a38af80..ff1812c9b5f 100644 --- a/content/cli/v11/using-npm/config.mdx +++ b/content/cli/v11/using-npm/config.mdx @@ -25,11 +25,20 @@ npm gets its configuration values from the following sources, sorted by priority #### Command Line Flags +A flag, also known as a switch or command-line option, is a parameter provided to the CLI to act upon. + _**Note:** In this document `foo` and `bar` are used as placeholders to represent generic examples of parameter names and values. They are not literal parameters._ -Putting `--foo bar` on the command line sets the `foo` configuration parameter to `"bar"`. A `--` argument tells the cli parser to stop reading flags. Using `--flag` without specifying any value will set the value to `true`. +Using `--` by itself tells the CLI parser to stop interpreting further arguments (such as `foo`) as flags. + +Instead, using `--foo` without any further value will set the value of `foo` to `true`. + +Alternatively, using `--foo bar` with `bar` as the supplied value will set the value of `--foo` to `bar`. -Example: `--flag1 --flag2` will set both configuration parameters to `true`, while `--flag1 --flag2 bar` will set `flag1` to `true`, and `flag2` to `bar`. Finally, `--flag1 --flag2 -- bar` will set both configuration parameters to `true`, and the `bar` is taken as a command argument. +**Example:** +* Using `--flag1 --flag2` will set both configuration parameters `flag1` and `flag2` to `true` as no further value is provided for either. +* Using `--flag1 --flag2 bar` will set the value of `flag1` to `true`, and the value of `flag2` to `bar`. +* Using `--flag1 --flag2 -- bar` will set the values of both `flag1` and `flag2` to `true`, while `bar` is treated as a regular command argument. #### Environment Variables From bd28ff476ded2fcbd097068834b7ca00bc3dd012 Mon Sep 17 00:00:00 2001 From: SuperHeavyBallet Date: Wed, 29 Oct 2025 18:46:25 +0100 Subject: [PATCH 3/3] style:format edited files with Prettier --- content/cli/v11/using-npm/config.mdx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/content/cli/v11/using-npm/config.mdx b/content/cli/v11/using-npm/config.mdx index ff1812c9b5f..bfa1f37dfbc 100644 --- a/content/cli/v11/using-npm/config.mdx +++ b/content/cli/v11/using-npm/config.mdx @@ -25,20 +25,21 @@ npm gets its configuration values from the following sources, sorted by priority #### Command Line Flags -A flag, also known as a switch or command-line option, is a parameter provided to the CLI to act upon. +A flag, also known as a switch or command-line option, is a parameter provided to the CLI to act upon. _**Note:** In this document `foo` and `bar` are used as placeholders to represent generic examples of parameter names and values. They are not literal parameters._ Using `--` by itself tells the CLI parser to stop interpreting further arguments (such as `foo`) as flags. -Instead, using `--foo` without any further value will set the value of `foo` to `true`. +Instead, using `--foo` without any further value will set the value of `foo` to `true`. Alternatively, using `--foo bar` with `bar` as the supplied value will set the value of `--foo` to `bar`. **Example:** -* Using `--flag1 --flag2` will set both configuration parameters `flag1` and `flag2` to `true` as no further value is provided for either. -* Using `--flag1 --flag2 bar` will set the value of `flag1` to `true`, and the value of `flag2` to `bar`. -* Using `--flag1 --flag2 -- bar` will set the values of both `flag1` and `flag2` to `true`, while `bar` is treated as a regular command argument. + +- Using `--flag1 --flag2` will set both configuration parameters `flag1` and `flag2` to `true` as no further value is provided for either. +- Using `--flag1 --flag2 bar` will set the value of `flag1` to `true`, and the value of `flag2` to `bar`. +- Using `--flag1 --flag2 -- bar` will set the values of both `flag1` and `flag2` to `true`, while `bar` is treated as a regular command argument. #### Environment Variables