Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/rstack/src/fmt/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ ${color.yellow(' $ rs fmt [options] [files/globs...]')}
Format files with Prettier.

${color.cyan('Options')}:
--write Write formatted files in place (default)
--check Check whether files are formatted
--list-different Print paths of unformatted files
--ignore-path <path> Path to an additional ignore file (repeatable)
--write Write formatted files in place (default)
--check Check whether files are formatted
--list-different Print paths of unformatted files
--ignore-path <path> Path to an additional ignore file (repeatable)
--parallel-workers <count> Number of parallel workers
--stdin-filepath <path> Format stdin as if it were saved at <path>
-h, --help Display this help message`;
--stdin-filepath <path> Format stdin as if it were saved at <path>
-h, --help Display this help message`;

const parseMaxWorkers = (
kebabValue: string | undefined,
Expand Down
17 changes: 17 additions & 0 deletions packages/rstack/tests/fmt/__snapshots__/cli.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Rstest Snapshot v1

exports[`provides command help 1`] = `
"Usage:
$ rs fmt [options] [files/globs...]

Format files with Prettier.

Options:
--write Write formatted files in place (default)
--check Check whether files are formatted
--list-different Print paths of unformatted files
--ignore-path <path> Path to an additional ignore file (repeatable)
--parallel-workers <count> Number of parallel workers
--stdin-filepath <path> Format stdin as if it were saved at <path>
-h, --help Display this help message"
`;
12 changes: 4 additions & 8 deletions packages/rstack/tests/fmt/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,10 @@ test('rejects file arguments with --stdin-filepath', () => {
});

test('provides command help', () => {
expect(fmtHelpMessage).toContain('Usage:\n $ rs fmt [options] [files/globs...]');
expect(fmtHelpMessage).toContain('--write');
expect(fmtHelpMessage).toContain('--check');
expect(fmtHelpMessage).toContain('--list-different');
expect(fmtHelpMessage).toContain('--ignore-path <path>');
expect(fmtHelpMessage).toContain('--parallel-workers <count>');
expect(fmtHelpMessage).toContain('--stdin-filepath <path>');
expect(fmtHelpMessage).toContain('-h, --help');
const helpMessage = stripVTControlCharacters(fmtHelpMessage).replace(/^Rstack v.*\n\n/, '');

expect(helpMessage).toContain('Usage:\n $ rs fmt [options] [files/globs...]');
expect(helpMessage).toMatchSnapshot();
Comment thread
chenjiahan marked this conversation as resolved.
});

test.each([
Expand Down