Skip to content

Commit

Permalink
feat(error): change stdout to stderr for all output
Browse files Browse the repository at this point in the history
  • Loading branch information
Ant0wan committed Jun 4, 2023
1 parent 7498d62 commit c27875c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Commands {
}

pub fn print_usage() {
println!("Usage: tfam [global options] <subcommand> [args]"); // To complete
eprintln!("Usage: tfam [global options] <subcommand> [args]"); // To complete
}

impl Commands {
Expand Down Expand Up @@ -72,15 +72,15 @@ impl Commands {
if let Some(suffix) = arg.strip_prefix("-var-file=") {
cmd.varfiles.push(suffix.to_string());
} else {
println!("Error, no varfile specified. `-var-file=` cannot be empty.");
eprintln!("Error, no varfile specified. `-var-file=` cannot be empty.");
}
}
if let true = arg.starts_with("-workspace-format=") {
if let Some(suffix) = arg.strip_prefix("-workspace-format=") {
cmd.workspaceformat = suffix.to_string();
allformats.push(suffix.to_string());
} else {
println!("Error, no format specified. `-workspace-format=` cannot be empty.");
eprintln!("Error, no format specified. `-workspace-format=` cannot be empty.");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn process_file(cmd: &Commands, file: &String) -> ExitStatus {
if let Ok(variable) = env::var("TF_CLI_ARGS") {
tf_cli_args = format!("{variable} -var-file {file}");
}
println!(
eprintln!(
"TF_WORKSPACE={} TF_CLI_ARGS='{}' {} {} ",
workspace,
tf_cli_args,
Expand All @@ -37,7 +37,7 @@ pub fn exec(cmd: &Arc<Commands>) -> ExitStatus {
let mut last_error: ExitStatus = ExitStatus::from_raw(0);

if cmd.varfiles.is_empty() {
println!("{} {}", cmd.bin, cmd.tfargs.join(" "));
eprintln!("{} {}", cmd.bin, cmd.tfargs.join(" "));
Command::new(&cmd.bin)
.args(&cmd.tfargs)
.status()
Expand Down

0 comments on commit c27875c

Please # to comment.