Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions zkstack_cli/crates/zkstack/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,22 @@ impl ShellAutocomplete for clap_complete::Shell {
.context(format!("could not read .{}rc", shell))?;

if !shell_rc_content.contains("# zkstack completion") {
std::fs::write(
shell_rc,
let completion_snippet = if shell == "zsh" {
format!(
"{}\n# zkstack completion\nautoload -Uz compinit\ncompinit\nsource \"{}\"\n",
shell_rc_content,
completion_file.to_str().unwrap()
)
} else {
format!(
"{}\n# zkstack completion\nsource \"{}\"\n",
shell_rc_content,
completion_file.to_str().unwrap()
),
)
.context(format!("could not write .{}rc", shell))?;
)
};

std::fs::write(shell_rc, completion_snippet)
.context(format!("could not write .{}rc", shell))?;
}
} else {
println!(
Expand Down
Loading