Skip to content
Snippets Groups Projects
Commit a8c22d16 authored by Michael Aaron Murphy's avatar Michael Aaron Murphy
Browse files

Commands can be expanded now

Fixes issues like the following:
    ~/.cargo/bin/ion -c echo test
    let COM = echo; $COM test
parent 7d06182a
No related branches found
No related tags found
No related merge requests found
......@@ -275,12 +275,12 @@ impl<'a> PipelineExecution for Shell<'a> {
} else if Path::new(&job.args[0]).is_dir() {
eprintln!("ion: cannot execute directory as command");
return Err(FAILURE);
} else if self.functions.contains_key::<str>(job.command.as_ref()) {
RefinedJob::function(job.command, job.args.drain().collect())
} else if self.builtins.contains_key::<str>(job.command.as_ref()) {
RefinedJob::builtin(job.command, job.args.drain().collect())
} else if self.functions.contains_key::<str>(job.args[0].as_ref()) {
RefinedJob::function(job.args[0].clone().into(), job.args.drain().collect())
} else if self.builtins.contains_key::<str>(job.args[0].as_ref()) {
RefinedJob::builtin(job.args[0].clone().into(), job.args.drain().collect())
} else {
let mut command = Command::new(job.command);
let mut command = Command::new(job.args[0].clone());
for arg in job.args.drain().skip(1) {
command.arg(arg);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment