fix: keep shell program opt when checking

This commit is contained in:
Ashley Wulber 2025-08-07 23:44:53 -04:00 committed by Ashley Wulber
parent 35b40328a1
commit 69c5dff3bb

View file

@ -107,14 +107,10 @@ fn main() -> Result<(), Box<dyn Error>> {
Some("--no-daemon") => { Some("--no-daemon") => {
daemonize = false; daemonize = false;
} }
Some("-e") | Some("--command") => { Some("-e") | Some("--command") | Some("--") => {
// Handle the '--command' or '-e' flag // Handle the '--command' or '-e' flag
break; break;
} }
Some("--") => {
// End of flags, the next args are shell-related
break;
}
_ => { _ => {
//TODO: should this throw an error? //TODO: should this throw an error?
log::warn!("ignored argument {:?}", arg); log::warn!("ignored argument {:?}", arg);
@ -123,7 +119,7 @@ fn main() -> Result<(), Box<dyn Error>> {
} }
// After flags, process remaining shell program and args // After flags, process remaining shell program and args
while let Some(arg) = raw_args.next_os(&mut cursor) { while let Some(arg) = raw_args.next_os(&mut cursor) {
if let Some(program) = shell_program_opt.take() { if shell_program_opt.is_some() {
shell_args.push(arg.to_string_lossy().to_string()); shell_args.push(arg.to_string_lossy().to_string());
} else { } else {
shell_program_opt = Some(arg.to_string_lossy().to_string()); shell_program_opt = Some(arg.to_string_lossy().to_string());