diff --git a/src/cli.rs b/src/cli.rs index 572c8db..3faa847 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -16,7 +16,7 @@ pub fn print_usage() { } pub fn parse_commands() -> (Vec, Commands) { - let mut args: Vec = env::args().collect(); + let mut args: Vec = env::args().skip(1).collect(); let mut cmd = Commands { interactive: false, concurrent: false, @@ -28,7 +28,7 @@ pub fn parse_commands() -> (Vec, Commands) { }; let mut allformats: Vec = Vec::new(); - let mut args_iter = args.iter().skip(1); + let mut args_iter = args.iter(); while let Some(arg) = args_iter.next() { match arg.as_str() { "-interactive" => match env::var("TF_IN_AUTOMATION") { @@ -75,7 +75,6 @@ pub fn parse_commands() -> (Vec, Commands) { _ => {} } } - if cmd.interactive || cmd.automation { args.retain(|x| x != "-interactive"); } diff --git a/src/exec.rs b/src/exec.rs index 55b031e..9c59902 100644 --- a/src/exec.rs +++ b/src/exec.rs @@ -13,9 +13,9 @@ pub fn execute_varfiles(args: Vec, cmd: Commands) { fn exec(args: Vec, varfile: String, workspaceformat: String) { println!( - "TF_WORKSPACE={} {:?} -var-file={:?}", + "TF_WORKSPACE={} terraform {} -var-file={:?}", get_workspace(varfile.clone(), workspaceformat), - args, + args.join(" "), varfile ); }