fix: leading space after privilege command

This commit is contained in:
iff 2024-12-16 17:19:53 +01:00
parent c7df749278
commit d8c076dcf7

View file

@ -137,12 +137,6 @@ impl Data {
};
}
#[cfg(debug_assertions)]
{
eprintln!("modules: {:?}", modules);
eprintln!("fallbacks: {:?}", fallbacks);
}
let mut init = Data {
shell,
command,
@ -160,6 +154,15 @@ impl Data {
init.split();
init.update_error(None);
#[cfg(debug_assertions)] {
eprintln!("shell: {}", init.shell);
eprintln!("command: {}", init.command);
eprintln!("error: {}", init.error);
eprintln!("modules: {:?}", init.modules);
eprintln!("fallbacks: {:?}", init.fallbacks);
}
init
}
@ -190,7 +193,7 @@ impl Data {
pub fn split(&mut self) {
let mut split = split_command(&self.command);
if PRIVILEGE_LIST.contains(&split[0].as_str()) {
self.command = self.command.replacen(&split[0], "", 1);
self.command = self.command.replacen(&split[0], "", 1).trim().to_string();
self.privilege = Some(split.remove(0))
}
self.split = split;