Skip to content

Commit e560bfc

Browse files
authored
fix: remove unnecessary boolean values in rerun suggestions (#1144)
## PR Checklist - [X] Addresses an existing open issue: fixes #1129 - [X] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [X] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview This PR fixes an issue in the rerun suggestions, where `true` is unnecessarily being printed. This change leads to the following: ```shell # previous npx create-typescript-app --mode create --skip-install true # new npx create-typescript-app --mode create --skip-install ``` The related tests have also been changed.
1 parent a959787 commit e560bfc

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/create/createRerunSuggestion.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe("createRerunSuggestion", () => {
4646
const actual = createRerunSuggestion(options);
4747

4848
expect(actual).toMatchInlineSnapshot(
49-
`"npx create-typescript-app --mode create --base everything --access public --author TestAuthor --description "Test description." --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --keywords "abc def ghi jkl mno pqr" --mode create --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title "Test Title""`,
49+
`"npx create-typescript-app --mode create --base everything --access public --author TestAuthor --description "Test description." --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors --exclude-compliance --exclude-lint-jsdoc --exclude-lint-json --exclude-lint-knip --exclude-lint-package-json --exclude-lint-perfectionist --keywords "abc def ghi jkl mno pqr" --mode create --owner TestOwner --repository test-repository --skip-github-api --skip-install --skip-removal --title "Test Title""`,
5050
);
5151
});
5252

@@ -61,7 +61,7 @@ describe("createRerunSuggestion", () => {
6161
});
6262

6363
expect(actual).toMatchInlineSnapshot(
64-
`"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --description "Test description." --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --guide https://example.com --guide-title "Test Title" --keywords "abc def ghi jkl mno pqr" --mode initialize --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title "Test Title""`,
64+
`"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --description "Test description." --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors --exclude-compliance --exclude-lint-jsdoc --exclude-lint-json --exclude-lint-knip --exclude-lint-package-json --exclude-lint-perfectionist --guide https://example.com --guide-title "Test Title" --keywords "abc def ghi jkl mno pqr" --mode initialize --owner TestOwner --repository test-repository --skip-github-api --skip-install --skip-removal --title "Test Title""`,
6565
);
6666
});
6767

@@ -76,7 +76,7 @@ describe("createRerunSuggestion", () => {
7676
});
7777

7878
expect(actual).toMatchInlineSnapshot(
79-
`"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --description "Test description." --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --keywords "abc def ghi jkl mno pqr" --logo test/src.png --logo-alt "Test alt." --mode initialize --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title "Test Title""`,
79+
`"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --description "Test description." --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors --exclude-compliance --exclude-lint-jsdoc --exclude-lint-json --exclude-lint-knip --exclude-lint-package-json --exclude-lint-perfectionist --keywords "abc def ghi jkl mno pqr" --logo test/src.png --logo-alt "Test alt." --mode initialize --owner TestOwner --repository test-repository --skip-github-api --skip-install --skip-removal --title "Test Title""`,
8080
);
8181
});
8282

@@ -90,7 +90,7 @@ describe("createRerunSuggestion", () => {
9090
});
9191

9292
expect(actual).toMatchInlineSnapshot(
93-
`"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --description "Test description." --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-md true --exclude-lint-package-json true --exclude-lint-perfectionist true --exclude-lint-spelling true --keywords "abc def ghi jkl mno pqr" --mode initialize --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title "Test Title""`,
93+
`"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --description "Test description." --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors --exclude-compliance --exclude-lint-jsdoc --exclude-lint-json --exclude-lint-knip --exclude-lint-md --exclude-lint-package-json --exclude-lint-perfectionist --exclude-lint-spelling --keywords "abc def ghi jkl mno pqr" --mode initialize --owner TestOwner --repository test-repository --skip-github-api --skip-install --skip-removal --title "Test Title""`,
9494
);
9595
});
9696

src/create/createRerunSuggestion.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function createRerunSuggestion(options: Partial<Options>): string {
4545
undefined && !!value,
4646
)
4747
.map(([key, value]) => {
48-
return `--${getFirstMatchingArg(key)} ${stringifyValue(value)}`;
48+
return `--${getFirstMatchingArg(key)}${stringifyValue(value)}`;
4949
})
5050
.join(" ");
5151

@@ -59,9 +59,13 @@ function stringifyValue(
5959
return stringifyValue(value.join(" "));
6060
}
6161

62+
if (typeof value === "boolean" && value) {
63+
return "";
64+
}
65+
6266
const valueStringified = `${value}`;
6367

6468
return valueStringified.includes(" ")
65-
? `"${valueStringified}"`
66-
: valueStringified;
69+
? ` "${valueStringified}"`
70+
: ` ${valueStringified}`;
6771
}

0 commit comments

Comments
 (0)