Generate shell completions for x as well
This commit is contained in:
parent
13b77c687c
commit
bc1737b279
6 changed files with 5952 additions and 2 deletions
|
|
@ -270,7 +270,11 @@ impl Step for GenerateCompletions {
|
|||
(Bash, builder.src.join("src/etc/completions/x.py.sh")),
|
||||
(Zsh, builder.src.join("src/etc/completions/x.py.zsh")),
|
||||
(Fish, builder.src.join("src/etc/completions/x.py.fish")),
|
||||
(PowerShell, builder.src.join("src/etc/completions/x.py.ps1"))
|
||||
(PowerShell, builder.src.join("src/etc/completions/x.py.ps1")),
|
||||
(Bash, builder.src.join("src/etc/completions/x.sh")),
|
||||
(Zsh, builder.src.join("src/etc/completions/x.zsh")),
|
||||
(Fish, builder.src.join("src/etc/completions/x.fish")),
|
||||
(PowerShell, builder.src.join("src/etc/completions/x.ps1"))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -633,7 +633,14 @@ pub fn get_completion<G: clap_complete::Generator>(shell: G, path: &Path) -> Opt
|
|||
})
|
||||
};
|
||||
let mut buf = Vec::new();
|
||||
clap_complete::generate(shell, &mut cmd, "x.py", &mut buf);
|
||||
let (bin_name, _) = path
|
||||
.file_name()
|
||||
.expect("path should be a regular file")
|
||||
.to_str()
|
||||
.expect("file name should be UTF-8")
|
||||
.rsplit_once('.')
|
||||
.expect("file name should have an extension");
|
||||
clap_complete::generate(shell, &mut cmd, bin_name, &mut buf);
|
||||
if buf == current.as_bytes() {
|
||||
return None;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue