Skip to content

Commit

Permalink
fix: fixing bash messages
Browse files Browse the repository at this point in the history
  • Loading branch information
freexploit committed Apr 28, 2024
1 parent 6c052f4 commit 24560e9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/aiken/src/cmd/completion/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,18 @@ fn fish() -> miette::Result<()> {
fn bash() -> miette::Result<()> {

let prefix_dir = "bash-completion/completions";
let xdg_dirs = xdg::BaseDirectories::with_prefix(prefix_dir).expect("Cannot find xdg-base directory");
let aiken_bash = "aiken.completion.bash";
let xdg_dirs = xdg::BaseDirectories::with_prefix(prefix_dir).expect("Could not find completion directory {prefix_dir} in xdg directories.");
let home = std::env::var("HOME").expect("Environment variable 'HOME' not set but needed.");
let config_home = xdg_dirs.get_config_home();
let completion_path = xdg_dirs
.place_config_file("aiken.completion.bash").expect("Could not find completion directory {prefix_dir} in xdg directories.");
.place_config_file(aiken_bash).expect("Cannot create completion file {aiken_bash} under xdg directories");

let mut bashrc = OpenOptions::new()
.write(true)
.append(true)
.open(format!("{}/.bashrc", home))
.expect(".bashrc file not found");
.expect(".bashrc file not found in {home} directory");
if let Some(config) = config_home.to_str() {
let path: String = format!("source {config}");
if let Err(e) = writeln!(bashrc, "{}", path) {
Expand Down

0 comments on commit 24560e9

Please sign in to comment.