Repository: JoshuaKGoldberg/create-typescript-app (ts)

Issue:
🐛 Bug: Re-run command suggestion includes unnecessary --directory
### Bug Report Checklist

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have pulled the latest `main` branch of the repository.
- [X] I have [searched for related issues](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

I ran `npx create-typescript-app --mode create --base everything` and filled in all the options. At the end, it should have suggested a re-run command that:

* Included `--base everything` and `--mode create`
* Filled in values I provided in the prompt...
* ...and _not_ values implied by `--base everything` or `--mode create`



### Actual

This was the suggestion it printed:

```plaintext
●  Tip: to run again with the same input values, use: npx create-typescript-app --mode create --base everything --access public --description "Hooray. Delete." --directory delete-me-please --email-github git@joshuakgoldberg.com --email-npm npm@joshuakgoldberg.com --mode create --owner JoshuaKGoldberg --repository delete-me-please --title "Delete Me Please"
```

Note the `--directory delete-me-please`. That's implied by `--repository delete-me-please`. There's no need to print `--directory` if it's got the same value as `--repository`. Bug!

### Additional Info

_No response_

Pull request:
fix: don't suggest redundant --directory
## PR Checklist

- [x] Addresses an existing open issue: fixes #1126
- [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

💖 

Patch:
diff --git a/src/create/createRerunDirectorySuggestion.ts b/src/create/createRerunDirectorySuggestion.ts
new file mode 100644
index 0000000..3072994
--- /dev/null
+++ b/src/create/createRerunDirectorySuggestion.ts
@@ -0,0 +1,7 @@
+import { Options } from "../shared/types.js";
+
+export function createRerunDirectorySuggestion(options: Partial<Options>) {
+	const defaultValue = options.mode === "create" ? options.repository : ".";
+
+	return options.directory === defaultValue ? undefined : options.directory;
+}
diff --git a/src/create/createRerunSuggestion.ts b/src/create/createRerunSuggestion.ts
index 33fe3aa..0ffb978 100644
--- a/src/create/createRerunSuggestion.ts
+++ b/src/create/createRerunSuggestion.ts
@@ -4,6 +4,7 @@ import {
 	getExclusions,
 } from "../shared/options/exclusionKeys.js";
 import { Options } from "../shared/types.js";
+import { createRerunDirectorySuggestion } from "./createRerunDirectorySuggestion.js";
 
 function getFirstMatchingArg(key: string) {
 	return Object.keys(allArgOptions).find(
@@ -37,6 +38,7 @@ export function createRerunSuggestion(options: Partial<Options>): string {
 			skipAllContributorsApi: undefined,
 			skipGitHubApi: undefined,
 		}),
+		directory: createRerunDirectorySuggestion(options),
 	};
 
 	const args = Object.entries(optionsNormalized)


Test patch:
diff --git a/src/create/createRerunDirectorySuggestion.test.ts b/src/create/createRerunDirectorySuggestion.test.ts
new file mode 100644
index 0000000..9b47983
--- /dev/null
+++ b/src/create/createRerunDirectorySuggestion.test.ts
@@ -0,0 +1,48 @@
+import { describe, expect, it } from "vitest";
+
+import { createRerunDirectorySuggestion } from "./createRerunDirectorySuggestion.js";
+
+const directory = "test-directory";
+const repository = "test-repository";
+
+describe("createRerunDirectorySuggestion", () => {
+	it("returns undefined when mode is create and directory matches repository", () => {
+		const suggestion = createRerunDirectorySuggestion({
+			directory: repository,
+			mode: "create",
+			repository,
+		});
+
+		expect(suggestion).toBe(undefined);
+	});
+
+	it("returns directory when mode is create and directory doesn't match repository", () => {
+		const suggestion = createRerunDirectorySuggestion({
+			directory,
+			mode: "create",
+			repository,
+		});
+
+		expect(suggestion).toBe(directory);
+	});
+
+	it("returns undefined when mode is initialize and directory is .", () => {
+		const suggestion = createRerunDirectorySuggestion({
+			directory: ".",
+			mode: "initialize",
+			repository,
+		});
+
+		expect(suggestion).toBe(undefined);
+	});
+
+	it("returns directory when mode is initialize and directory is not .", () => {
+		const suggestion = createRerunDirectorySuggestion({
+			directory,
+			mode: "initialize",
+			repository,
+		});
+
+		expect(suggestion).toBe(directory);
+	});
+});
diff --git a/src/create/createRerunSuggestion.test.ts b/src/create/createRerunSuggestion.test.ts
index 9854ca3..856d55c 100644
--- a/src/create/createRerunSuggestion.test.ts
+++ b/src/create/createRerunSuggestion.test.ts
@@ -89,7 +89,7 @@ describe("createRerunSuggestion", () => {
 		});
 
 		expect(actual).toMatchInlineSnapshot(
-			`"npx create-typescript-app --base everything --author TestAuthor --description "Test description." --directory . --email-github github@email.com --email-npm npm@email.com --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""`,
+			`"npx create-typescript-app --base everything --author TestAuthor --description "Test description." --email-github github@email.com --email-npm npm@email.com --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""`,
 		);
 	});
 
@@ -104,7 +104,31 @@ describe("createRerunSuggestion", () => {
 		});
 
 		expect(actual).toMatchInlineSnapshot(
-			`"npx create-typescript-app --base everything --author TestAuthor --description "Test description." --directory . --email-github github@email.com --email-npm npm@email.com --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""`,
+			`"npx create-typescript-app --base everything --author TestAuthor --description "Test description." --email-github github@email.com --email-npm npm@email.com --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""`,
+		);
+	});
+
+	it("does not include directory when it is repository and the mode is create", () => {
+		const actual = createRerunSuggestion({
+			...options,
+			directory: options.repository,
+			mode: "create",
+		});
+
+		expect(actual).toMatchInlineSnapshot(
+			`"npx create-typescript-app --base everything --author TestAuthor --description "Test description." --email-github github@email.com --email-npm npm@email.com --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""`,
+		);
+	});
+
+	it("includes directory when it is repository and the mode is migrate", () => {
+		const actual = createRerunSuggestion({
+			...options,
+			directory: options.repository,
+			mode: "migrate",
+		});
+
+		expect(actual).toMatchInlineSnapshot(
+			`"npx create-typescript-app --base everything --author TestAuthor --description "Test description." --directory test-repository --email-github github@email.com --email-npm npm@email.com --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 migrate --owner TestOwner --repository test-repository --skip-github-api --skip-install --skip-removal --title "Test Title""`,
 		);
 	});
 
@@ -118,7 +142,7 @@ describe("createRerunSuggestion", () => {
 		});
 
 		expect(actual).toMatchInlineSnapshot(
-			`"npx create-typescript-app --base everything --author TestAuthor --description "Test description." --directory . --email-github github@email.com --email-npm npm@email.com --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""`,
+			`"npx create-typescript-app --base everything --author TestAuthor --description "Test description." --email-github github@email.com --email-npm npm@email.com --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""`,
 		);
 	});