From e97ff7adbb7855d94150c977b79f87736e3bb11b Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 12 Aug 2026 08:57:27 +0800 Subject: [PATCH] fix(rstack): align CLI help messages --- packages/rstack/src/cli/commands.ts | 8 +++----- packages/rstack/src/fmt/cli.ts | 1 + packages/rstack/src/setup/index.ts | 2 +- packages/rstack/src/staged.ts | 3 ++- .../rstack/tests/cli/__snapshots__/check.test.ts.snap | 5 +++-- packages/rstack/tests/cli/__snapshots__/help.test.ts.snap | 5 ++--- .../rstack/tests/cli/fmt/__snapshots__/files.test.ts.snap | 1 + .../tests/cli/setup/__snapshots__/index.test.ts.snap | 2 +- .../tests/cli/staged/__snapshots__/index.test.ts.snap | 3 ++- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/rstack/src/cli/commands.ts b/packages/rstack/src/cli/commands.ts index c2f1b716..3b19d6cd 100644 --- a/packages/rstack/src/cli/commands.ts +++ b/packages/rstack/src/cli/commands.ts @@ -5,7 +5,7 @@ import { hasHelpFlag, renderHelp } from './help.ts'; const renderRootHelp = (): string => renderHelp({ - usage: 'rs [command] [...options]', + usage: 'rs [command] [options]', sections: [ { title: 'Commands', @@ -48,6 +48,7 @@ const renderCheckHelp = (): string => title: 'Options', items: [ ['--type-check', 'Enable TypeScript type checking'], + ['-c, --config ', 'Specify Rstack config file path'], ['-h, --help', 'Display this help message'], ], }, @@ -182,10 +183,7 @@ const renderDocEjectHelp = (): string => sections: [ { title: 'Options', - items: [ - ['-c, --config ', 'Specify Rstack config file path'], - ['-h, --help', 'Display this help message'], - ], + items: [['-h, --help', 'Display this help message']], }, ], }); diff --git a/packages/rstack/src/fmt/cli.ts b/packages/rstack/src/fmt/cli.ts index d1a7ee7e..9344a2a0 100644 --- a/packages/rstack/src/fmt/cli.ts +++ b/packages/rstack/src/fmt/cli.ts @@ -46,6 +46,7 @@ const renderFmtHelp = (): string => ['--with-node-modules', 'Process files inside node_modules'], ['--parallel-workers ', 'Number of parallel workers'], ['--stdin-filepath ', 'Format stdin as if it were saved at '], + ['-c, --config ', 'Specify Rstack config file path'], ['-h, --help', 'Display this help message'], ], }, diff --git a/packages/rstack/src/setup/index.ts b/packages/rstack/src/setup/index.ts index 310638e4..5272ab98 100644 --- a/packages/rstack/src/setup/index.ts +++ b/packages/rstack/src/setup/index.ts @@ -6,7 +6,7 @@ import { installHooks } from './install.ts'; const renderSetupHelp = (): string => renderHelp({ usage: 'rs setup [options]', - description: 'Install Git hooks in the current repository.', + description: 'Install Git hooks in the current repository', sections: [ { title: 'Options', diff --git a/packages/rstack/src/staged.ts b/packages/rstack/src/staged.ts index 1dc45c87..339ddccd 100644 --- a/packages/rstack/src/staged.ts +++ b/packages/rstack/src/staged.ts @@ -36,13 +36,14 @@ const renderStagedHelp = (): string => ], ['--cwd ', 'Working directory to run all tasks in'], ['-d, --debug', 'Print additional debug information'], - ['--no-stash', 'Disable the backup stash. Implies "--no-revert".'], + ['--no-stash', 'Disable backup stash and automatic revert'], ['-q, --quiet', "Disable lint-staged's own console output"], ['-r, --relative', 'Pass relative filepaths to tasks'], [ '-v, --verbose', 'Show task output even when tasks succeed; by default only failed output is shown', ], + ['-c, --config ', 'Specify Rstack config file path'], ['-h, --help', 'Display this help message'], ], }, diff --git a/packages/rstack/tests/cli/__snapshots__/check.test.ts.snap b/packages/rstack/tests/cli/__snapshots__/check.test.ts.snap index b5fadcd8..c24f532b 100644 --- a/packages/rstack/tests/cli/__snapshots__/check.test.ts.snap +++ b/packages/rstack/tests/cli/__snapshots__/check.test.ts.snap @@ -9,7 +9,8 @@ Usage: Run static checks, including lint and format Options: - --type-check Enable TypeScript type checking - -h, --help Display this help message + --type-check Enable TypeScript type checking + -c, --config Specify Rstack config file path + -h, --help Display this help message " `; diff --git a/packages/rstack/tests/cli/__snapshots__/help.test.ts.snap b/packages/rstack/tests/cli/__snapshots__/help.test.ts.snap index eba47f5d..6198d4dd 100644 --- a/packages/rstack/tests/cli/__snapshots__/help.test.ts.snap +++ b/packages/rstack/tests/cli/__snapshots__/help.test.ts.snap @@ -59,8 +59,7 @@ Usage: Eject a theme component Options: - -c, --config Specify Rstack config file path - -h, --help Display this help message + -h, --help Display this help message " `; @@ -340,7 +339,7 @@ exports[`displays top-level help 1`] = ` "Rstack v Usage: - $ rs [command] [...options] + $ rs [command] [options] Commands: dev Run the app dev server diff --git a/packages/rstack/tests/cli/fmt/__snapshots__/files.test.ts.snap b/packages/rstack/tests/cli/fmt/__snapshots__/files.test.ts.snap index 6fb21f4a..7a669027 100644 --- a/packages/rstack/tests/cli/fmt/__snapshots__/files.test.ts.snap +++ b/packages/rstack/tests/cli/fmt/__snapshots__/files.test.ts.snap @@ -20,6 +20,7 @@ Options: --with-node-modules Process files inside node_modules --parallel-workers Number of parallel workers --stdin-filepath Format stdin as if it were saved at + -c, --config Specify Rstack config file path -h, --help Display this help message " `; diff --git a/packages/rstack/tests/cli/setup/__snapshots__/index.test.ts.snap b/packages/rstack/tests/cli/setup/__snapshots__/index.test.ts.snap index b4cbcf42..d238e172 100644 --- a/packages/rstack/tests/cli/setup/__snapshots__/index.test.ts.snap +++ b/packages/rstack/tests/cli/setup/__snapshots__/index.test.ts.snap @@ -6,7 +6,7 @@ exports[`displays setup help 1`] = ` Usage: $ rs setup [options] -Install Git hooks in the current repository. +Install Git hooks in the current repository Options: --hooks-dir Specify hooks directory relative to the Git repository root diff --git a/packages/rstack/tests/cli/staged/__snapshots__/index.test.ts.snap b/packages/rstack/tests/cli/staged/__snapshots__/index.test.ts.snap index ab0105da..0cd5e1a6 100644 --- a/packages/rstack/tests/cli/staged/__snapshots__/index.test.ts.snap +++ b/packages/rstack/tests/cli/staged/__snapshots__/index.test.ts.snap @@ -13,10 +13,11 @@ Options: -p, --concurrent The number of tasks to run concurrently, or false for serial --cwd Working directory to run all tasks in -d, --debug Print additional debug information - --no-stash Disable the backup stash. Implies "--no-revert". + --no-stash Disable backup stash and automatic revert -q, --quiet Disable lint-staged's own console output -r, --relative Pass relative filepaths to tasks -v, --verbose Show task output even when tasks succeed; by default only failed output is shown + -c, --config Specify Rstack config file path -h, --help Display this help message " `;