Skip to content

Commit

Permalink
generate zsh autocompletion for x
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Oct 14, 2023
1 parent 3e6d3d0 commit cbed6f9
Show file tree
Hide file tree
Showing 2 changed files with 741 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bootstrap/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,15 @@ impl Step for GenerateCompletions {

/// Uses `clap_complete` to generate shell completions.
fn run(self, builder: &Builder<'_>) {
// FIXME(clubby789): enable zsh when clap#4898 is fixed
let [bash, fish, powershell] = ["x.py.sh", "x.py.fish", "x.py.ps1"]
let [bash, zsh, fish, powershell] = ["x.py.sh", "x.py.zsh", "x.py.fish", "x.py.ps1"]
.map(|filename| builder.src.join("src/etc/completions").join(filename));

if let Some(comp) = get_completion(shells::Bash, &bash) {
std::fs::write(&bash, comp).expect("writing bash completion");
}
if let Some(comp) = get_completion(shells::Zsh, &zsh) {
std::fs::write(&zsh, comp).expect("writing bash completion");
}
if let Some(comp) = get_completion(shells::Fish, &fish) {
std::fs::write(&fish, comp).expect("writing fish completion");
}
Expand Down
Loading

0 comments on commit cbed6f9

Please sign in to comment.