Skip to content

Commit 0b74af3

Browse files
authored
fix(fmt): align help option descriptions (#173)
1 parent 723dc5b commit 0b74af3

3 files changed

Lines changed: 27 additions & 14 deletions

File tree

packages/rstack/src/fmt/cli.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ ${color.yellow(' $ rs fmt [options] [files/globs...]')}
2626
Format files with Prettier.
2727
2828
${color.cyan('Options')}:
29-
--write Write formatted files in place (default)
30-
--check Check whether files are formatted
31-
--list-different Print paths of unformatted files
32-
--ignore-path <path> Path to an additional ignore file (repeatable)
29+
--write Write formatted files in place (default)
30+
--check Check whether files are formatted
31+
--list-different Print paths of unformatted files
32+
--ignore-path <path> Path to an additional ignore file (repeatable)
3333
--parallel-workers <count> Number of parallel workers
34-
--stdin-filepath <path> Format stdin as if it were saved at <path>
35-
-h, --help Display this help message`;
34+
--stdin-filepath <path> Format stdin as if it were saved at <path>
35+
-h, --help Display this help message`;
3636

3737
const parseMaxWorkers = (
3838
kebabValue: string | undefined,
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Rstest Snapshot v1
2+
3+
exports[`provides command help 1`] = `
4+
"Usage:
5+
$ rs fmt [options] [files/globs...]
6+
7+
Format files with Prettier.
8+
9+
Options:
10+
--write Write formatted files in place (default)
11+
--check Check whether files are formatted
12+
--list-different Print paths of unformatted files
13+
--ignore-path <path> Path to an additional ignore file (repeatable)
14+
--parallel-workers <count> Number of parallel workers
15+
--stdin-filepath <path> Format stdin as if it were saved at <path>
16+
-h, --help Display this help message"
17+
`;

packages/rstack/tests/fmt/cli.test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,10 @@ test('rejects file arguments with --stdin-filepath', () => {
139139
});
140140

141141
test('provides command help', () => {
142-
expect(fmtHelpMessage).toContain('Usage:\n $ rs fmt [options] [files/globs...]');
143-
expect(fmtHelpMessage).toContain('--write');
144-
expect(fmtHelpMessage).toContain('--check');
145-
expect(fmtHelpMessage).toContain('--list-different');
146-
expect(fmtHelpMessage).toContain('--ignore-path <path>');
147-
expect(fmtHelpMessage).toContain('--parallel-workers <count>');
148-
expect(fmtHelpMessage).toContain('--stdin-filepath <path>');
149-
expect(fmtHelpMessage).toContain('-h, --help');
142+
const helpMessage = stripVTControlCharacters(fmtHelpMessage).replace(/^Rstack v.*\n\n/, '');
143+
144+
expect(helpMessage).toContain('Usage:\n $ rs fmt [options] [files/globs...]');
145+
expect(helpMessage).toMatchSnapshot();
150146
});
151147

152148
test.each([

0 commit comments

Comments
 (0)