Skip to content

Commit

Permalink
Clarify doctor help (#1412).
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed May 20, 2024
1 parent d7acbff commit 0f17df2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,13 @@ Run `ncu --help [OPTION]` to view advanced help for a specific option, or see be

Usage:

ncu --doctor
ncu --doctor -u
ncu --no-doctor
ncu -d
ncu -du

Iteratively installs upgrades and runs tests to identify breaking upgrades. Reverts broken upgrades and updates package.json with working upgrades.
Iteratively installs upgrades and runs your project's tests to identify breaking upgrades. Reverts broken upgrades and updates package.json with working upgrades.

Add `-u` to execute (modifies your package file, lock file, and node_modules)
Requires `-u` to execute (modifies your package file, lock file, and node_modules)

To be more precise:

Expand Down
10 changes: 6 additions & 4 deletions src/cli-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ const uncode = (s: string) => s.replace(/`/g, '')
export const renderExtendedHelp = (option: CLIOption, { markdown }: { markdown?: boolean } = {}) => {
let output = ''
if (option.cli !== false) {
// add -u to doctor option
output = `Usage:
ncu --${option.long}${option.arg ? ` [${option.arg}]` : ''}\n`
ncu --${option.long}${option.arg ? ` [${option.arg}]` : ''}${option.long === 'doctor' ? ' -u' : ''}\n`
}
if (option.type === 'boolean') {
output += ` ncu --no-${option.long}\n`
}
if (option.short) {
output += ` ncu -${option.short}${option.arg ? ` [${option.arg}]` : ''}\n`
// add -u to doctor option
output += ` ncu -${option.short}${option.arg ? ` [${option.arg}]` : ''}${option.long === 'doctor' ? 'u' : ''}\n`
}

if (option.default !== undefined && !(Array.isArray(option.default) && option.default.length === 0)) {
Expand All @@ -61,9 +63,9 @@ export const renderExtendedHelp = (option: CLIOption, { markdown }: { markdown?:
/** Extended help for the --doctor option. */
const extendedHelpDoctor: ExtendedHelp = ({
markdown,
}) => `Iteratively installs upgrades and runs tests to identify breaking upgrades. Reverts broken upgrades and updates package.json with working upgrades.
}) => `Iteratively installs upgrades and runs your project's tests to identify breaking upgrades. Reverts broken upgrades and updates package.json with working upgrades.
${chalk.yellow('Add `-u` to execute')} (modifies your package file, lock file, and node_modules)
${chalk.yellow('Requires `-u` to execute')} (modifies your package file, lock file, and node_modules)
To be more precise:
Expand Down

0 comments on commit 0f17df2

Please sign in to comment.