Skip to content

Commit 8f63662

Browse files
chore: fix zkstack completion for zsh
1 parent 9b121c9 commit 8f63662

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

zkstack_cli/crates/zkstack/build.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,22 @@ impl ShellAutocomplete for clap_complete::Shell {
112112
.context(format!("could not read .{}rc", shell))?;
113113

114114
if !shell_rc_content.contains("# zkstack completion") {
115-
std::fs::write(
116-
shell_rc,
115+
let completion_snippet = if shell == "zsh" {
116+
format!(
117+
"{}\n# zkstack completion\nautoload -Uz compinit\ncompinit\nsource \"{}\"\n",
118+
shell_rc_content,
119+
completion_file.to_str().unwrap()
120+
)
121+
} else {
117122
format!(
118123
"{}\n# zkstack completion\nsource \"{}\"\n",
119124
shell_rc_content,
120125
completion_file.to_str().unwrap()
121-
),
122-
)
123-
.context(format!("could not write .{}rc", shell))?;
126+
)
127+
};
128+
129+
std::fs::write(shell_rc, completion_snippet)
130+
.context(format!("could not write .{}rc", shell))?;
124131
}
125132
} else {
126133
println!(

0 commit comments

Comments
 (0)