Skip to content

Commit 4546bef

Browse files
authored
Remove legacy init-template-dir command (#2623)
Removes the deprecated top-level `prek init-template-dir` spelling.
1 parent e63bd4b commit 4546bef

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎crates/prek/src/cli/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ pub(crate) enum Command {
279279
#[command(hide = true)]
280280
Clean,
281281
/// Install Git shims in a directory intended for use with `git config init.templateDir`.
282-
#[command(alias = "init-templatedir", hide = true)]
282+
#[command(name = "init-templatedir", hide = true)]
283283
InitTemplateDir(InitTemplateDirArgs),
284284
/// Try hooks from a repository.
285285
TryRepo(Box<TryRepoArgs>),

‎crates/prek/tests/install.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ fn uninstall_remove_legacy_hook() -> anyhow::Result<()> {
12101210
}
12111211

12121212
#[test]
1213-
fn init_template_dir() -> anyhow::Result<()> {
1213+
fn init_templatedir() -> anyhow::Result<()> {
12141214
let context = TestEnv::new();
12151215

12161216
cmd_snapshot!(context, context.command().arg("init-templatedir").arg(".git"), @r#"
@@ -1302,7 +1302,7 @@ fn init_template_dir() -> anyhow::Result<()> {
13021302
fn util_init_template_dir() {
13031303
let context = TestEnv::new();
13041304

1305-
cmd_snapshot!(context, context.command().arg("util").arg("init-templatedir").arg(".git"), @r#"
1305+
cmd_snapshot!(context, context.command().arg("util").arg("init-template-dir").arg(".git"), @r#"
13061306
success: true
13071307
exit_code: 0
13081308
----- stdout -----
@@ -1329,12 +1329,12 @@ fn util_init_template_dir() {
13291329
"#);
13301330
}
13311331

1332-
/// Tests `prek init-template-dir` in a non-git repository.
1332+
/// Tests `prek util init-template-dir` in a non-git repository.
13331333
#[test]
13341334
fn init_template_dir_non_git_repo() {
13351335
let context = TestEnv::new_without_git();
13361336

1337-
cmd_snapshot!(context, context.command().arg("init-template-dir").arg(".git"), @r#"
1337+
cmd_snapshot!(context, context.command().arg("util").arg("init-template-dir").arg(".git"), @r#"
13381338
success: true
13391339
exit_code: 0
13401340
----- stdout -----
@@ -1353,7 +1353,7 @@ fn init_template_dir_non_git_repo() {
13531353
repos:
13541354
",
13551355
);
1356-
cmd_snapshot!(context, context.command().arg("init-template-dir").arg("-c").arg(context.work_dir().join(PRE_COMMIT_CONFIG_YAML)).arg(".git"), @r"
1356+
cmd_snapshot!(context, context.command().arg("util").arg("init-template-dir").arg("-c").arg(context.work_dir().join(PRE_COMMIT_CONFIG_YAML)).arg(".git"), @r"
13571357
success: true
13581358
exit_code: 0
13591359
----- stdout -----
@@ -1693,7 +1693,7 @@ fn workspace_init_template_dir() -> anyhow::Result<()> {
16931693
let template_dir = context.work_dir().child("template");
16941694
template_dir.create_dir_all()?;
16951695

1696-
cmd_snapshot!(context, context.command().arg("init-template-dir").arg(&*template_dir), @r"
1696+
cmd_snapshot!(context, context.command().arg("util").arg("init-template-dir").arg(&*template_dir), @r"
16971697
success: true
16981698
exit_code: 0
16991699
----- stdout -----

‎docs/compatibility.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
| `prek gc` | `prek cache gc` |
2121
| `prek clean` | `prek cache clean` |
2222
| `prek init-templatedir` | `prek util init-template-dir` |
23-
| `prek init-template-dir` | `prek util init-template-dir` |
2423
| `pre-commit migrate-config` | Not provided directly; use `prek util yaml-to-toml` to migrate YAML to `prek.toml` |
2524

2625
## Why the CLI is reorganized

0 commit comments

Comments
 (0)