diff --git a/core/src/main.rs b/core/src/main.rs index 8feb5e9..09cb604 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -51,7 +51,6 @@ fn main() -> Result<(), std::io::Error> { init.ok().unwrap() }; - data.expand_command(); use shell::Mode::*; match data.mode { Suggestion => modes::suggestion(&mut data), diff --git a/core/src/shell.rs b/core/src/shell.rs index 6925f21..ace217c 100644 --- a/core/src/shell.rs +++ b/core/src/shell.rs @@ -163,12 +163,14 @@ impl Data { }; init.split(); + init.expand_command(); if init.mode != Mode::Cnf { init.update_error(None); } #[cfg(debug_assertions)] { + eprintln!("/// data initialization"); eprintln!("shell: {}", init.shell); eprintln!("command: {}", init.command); eprintln!("error: {}", init.error); @@ -209,6 +211,8 @@ impl Data { self.command = self.command.replacen(&split[0], "", 1).trim().to_string(); self.privilege = Some(split.remove(0)) } + #[cfg(debug_assertions)] + eprintln!("split: {:?}", split); self.split = split; } @@ -454,7 +458,7 @@ pub fn expand_alias_multiline(map: &HashMap, command: &str) -> O } } if expansion { - Some(expanded) + Some(expanded.trim().to_string()) } else { None } diff --git a/core/src/suggestions.rs b/core/src/suggestions.rs index da1af1a..db0e52b 100644 --- a/core/src/suggestions.rs +++ b/core/src/suggestions.rs @@ -30,6 +30,10 @@ pub fn suggest_candidates(data: &mut Data) { #[cfg(debug_assertions)] { + eprintln!("/// suggest_candidates"); + eprintln!("split: {:?}", data.split); + eprintln!("command: {command}"); + eprintln!("privilege: {privilege:?}"); eprintln!("modules: {modules:?}"); eprintln!("fallbacks: {fallbacks:?}"); }