Skip to content

Commit

Permalink
fix(rules/command_not_found): fix bash support
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene-babichenko committed Nov 15, 2024
1 parent aa9e036 commit 9e870f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rules/command_not_found.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn command_not_found_impl(
}

fn detect_command(cmd: &[String], error: &str) -> Option<usize> {
let regex_bash = Regex::new(r"bash: ([^\s]+): command not found(...)?").unwrap();
let regex_bash = Regex::new(r"bash:(?: line \d+:)? ([^\s]+): command not found(...)?").unwrap();
let regex_zsh = Regex::new(r"zsh: command not found: ([^\s]+)").unwrap();
let regex_fish = Regex::new(r"fish: unknown command: ([^\s]+)").unwrap();
let regex_powershell = Regex::new(r"the term '([^']+)' is not recognized").unwrap();
Expand Down
4 changes: 2 additions & 2 deletions tests/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ fn bash() {

p.send_line("eval \"$(fixit init bash)\"").unwrap();
p.send_line("eco 'Hello, world!'").unwrap();
// p.expect("command not found").unwrap();
p.expect("command not found").unwrap();
p.send_line("fix").unwrap();
p.send_line("").unwrap();
// p.expect("Hello, world!").unwrap();
p.expect("Hello, world!").unwrap();
p.send_line("exit").unwrap();

let mut buf = String::new();
Expand Down

0 comments on commit 9e870f2

Please sign in to comment.