From b876442241b9d366a0541714bbee1ae50d6746fd Mon Sep 17 00:00:00 2001 From: Gar Date: Fri, 19 Mar 2021 11:56:18 -0700 Subject: fix(usage): tie usage to config This starts us down the path of tying the params our commands accept to their config items. For now it is optional, and not every current config item would cleanly render if we added them today. The ones that are added here DO render nicely, and we can iterate from here. We can also at a later date do the same kind of appraoch with our positional args. PR-URL: https://github.com/npm/cli/pull/2908 Credit: @wraithgar Close: #2908 Reviewed-by: @nlf, @isaacs --- tap-snapshots/test-lib-publish.js-TAP.test.js | 5 +- ...est-lib-utils-config-definitions.js-TAP.test.js | 1 + ...st-lib-utils-config-describe-all.js-TAP.test.js | 7 ++ .../test-lib-utils-npm-usage.js-TAP.test.js | 84 +++++++++++++++++----- 4 files changed, 79 insertions(+), 18 deletions(-) (limited to 'tap-snapshots') diff --git a/tap-snapshots/test-lib-publish.js-TAP.test.js b/tap-snapshots/test-lib-publish.js-TAP.test.js index e777797d7..172ed5b29 100644 --- a/tap-snapshots/test-lib-publish.js-TAP.test.js +++ b/tap-snapshots/test-lib-publish.js-TAP.test.js @@ -11,7 +11,10 @@ npm publish Publish a package Usage: -npm publish [] [--tag ] [--access ] [--dry-run] +npm publish [] + +Options: +[--tag ] [--access ] [--dry-run] Run "npm help publish" for more info ` diff --git a/tap-snapshots/test-lib-utils-config-definitions.js-TAP.test.js b/tap-snapshots/test-lib-utils-config-definitions.js-TAP.test.js index d6a72b99b..2ed810da8 100644 --- a/tap-snapshots/test-lib-utils-config-definitions.js-TAP.test.js +++ b/tap-snapshots/test-lib-utils-config-definitions.js-TAP.test.js @@ -144,6 +144,7 @@ Array [ "version", "versions", "viewer", + "which", "workspace", "workspaces", "yes", diff --git a/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js b/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js index 909b31f83..10cc2b238 100644 --- a/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js +++ b/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js @@ -1192,6 +1192,13 @@ The program to use to view help content. Set to \`"browser"\` to view html help content in the default web browser. +#### \`which\` + +* Default: null +* Type: null or Number + +If there are multiple funding sources, which 1-indexed source URL to open. + #### \`workspace\` * Default: diff --git a/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js b/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js index 11f7ff024..260e2ab8f 100644 --- a/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js +++ b/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js @@ -187,7 +187,10 @@ All commands: Add a registry user account Usage: - npm adduser [--registry=url] [--scope=@orgname] [--always-auth] + npm adduser + + Options: + [--registry ] [--scope <@scope>] [--always-auth] aliases: login, add-user @@ -198,8 +201,10 @@ All commands: Run a security audit Usage: - npm audit [--json] [--production] - npm audit fix [--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)] + npm audit [fix] + + Options: + [--dry-run] [-f|--force] [--json] [--package-lock-only] [--production] Run "npm help audit" for more info @@ -208,7 +213,10 @@ All commands: Display npm bin folder Usage: - npm bin [-g] + npm bin + + Options: + [-g|--global] Run "npm help bin" for more info @@ -396,7 +404,10 @@ All commands: Retrieve funding information Usage: - npm fund [--json] [--browser] [--unicode] [[<@scope>/] [--which=] + npm fund [[<@scope>/]] + + Options: + [--json] [--browser|--browser ] [--unicode] [--which ] Run "npm help fund" for more info @@ -459,7 +470,10 @@ All commands: npm install npm install npm install - npm install / [--save-prod|--save-dev|--save-optional|--save-peer] [--save-exact] [--no-save] + npm install / + + Options: + [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, add @@ -490,7 +504,10 @@ All commands: npm install-test npm install-test npm install-test - npm install-test / [--save-prod|--save-dev|--save-optional|--save-peer] [--save-exact] [--no-save] + npm install-test / + + Options: + [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] alias: it @@ -524,7 +541,10 @@ All commands: Add a registry user account Usage: - npm adduser [--registry=url] [--scope=@orgname] [--always-auth] + npm adduser + + Options: + [--registry ] [--scope <@scope>] [--always-auth] aliases: login, add-user @@ -535,7 +555,10 @@ All commands: Log out of the registry Usage: - npm logout [--registry=] [--scope=<@scope>] + npm logout + + Options: + [--registry ] [--scope <@scope>] Run "npm help logout" for more info @@ -590,7 +613,10 @@ All commands: Create a tarball from a package Usage: - npm pack [[<@scope>/]...] [--dry-run] + npm pack [[<@scope>/]...] + + Options: + [--dry-run] Run "npm help pack" for more info @@ -601,6 +627,9 @@ All commands: Usage: npm ping + Options: + [--registry ] + Run "npm help ping" for more info prefix npm prefix @@ -629,7 +658,10 @@ All commands: Remove extraneous packages Usage: - npm prune [[<@scope>/]...] [--production] + npm prune [[<@scope>/]...] + + Options: + [--production] Run "npm help prune" for more info @@ -638,7 +670,10 @@ All commands: Publish a package Usage: - npm publish [] [--tag ] [--access ] [--dry-run] + npm publish [] + + Options: + [--tag ] [--access ] [--dry-run] Run "npm help publish" for more info @@ -676,7 +711,10 @@ All commands: Display npm root Usage: - npm root [-g] + npm root + + Options: + [-g|--global] Run "npm help root" for more info @@ -696,7 +734,10 @@ All commands: Search for pacakges Usage: - npm search [-l|--long] [--json] [--parseable] [--no-description] [search terms ...] + npm search [search terms ...] + + Options: + [-l|--long] [--json] [-p|--parseable] [--no-description] aliases: s, se, find @@ -805,7 +846,10 @@ All commands: Remove a package Usage: - npm uninstall [<@scope>/][@]... [-S|--save|--no-save] + npm uninstall [<@scope>/]... + + Options: + [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] aliases: un, unlink, remove, rm, r @@ -834,7 +878,10 @@ All commands: Update packages Usage: - npm update [-g] [...] + npm update [...] + + Options: + [-g|--global] aliases: up, upgrade, udpate @@ -867,7 +914,10 @@ All commands: Display npm username Usage: - npm whoami [--registry ] + npm whoami + + Options: + [--registry ] Run "npm help whoami" for more info -- cgit v1.2.3