Skip to content

Commit

Permalink
Fix installation of bash completions (#2803) (#2804)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmsc authored Dec 14, 2024
1 parent 3ec2191 commit ecb095c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/fixed-bash-completion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the installation of bash completions.
5 changes: 3 additions & 2 deletions probe-rs-tools/src/bin/probe-rs/cmd/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,16 @@ export FPATH="$HOME/.zfunc:$FPATH"

impl ShellExt for Bash {
fn install(&self, file_name: &str, script: &str) -> Result<()> {
const DEST: &str = ".local/share/bash-completion/completions/";
let Some(dir) = directories::UserDirs::new() else {
println!("{script}");
eprintln!("The user home directory could not be located.");
eprintln!("Write the script to ~/.bash_completion/{file_name}");
eprintln!("Write the script to ~/{DEST}/{file_name}");
eprintln!("Install the autocompletion by reloading the bash");
return Ok(());
};

let path = dir.home_dir().join(".bash_completions/").join(file_name);
let path = dir.home_dir().join(DEST).join(file_name);
write_script(&path, script)
}
}
Expand Down

0 comments on commit ecb095c

Please sign in to comment.