-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #947 from multiversx/meta4
sc-meta emir MIR flag, print build command
- Loading branch information
Showing
4 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::process::Command; | ||
|
||
use colored::Colorize; | ||
|
||
pub fn format_command(command: &Command) -> String { | ||
let mut result = String::new(); | ||
for (key, opt_value) in command.get_envs() { | ||
if let Some(value) = opt_value { | ||
result += | ||
format!("{}=\"{}\" ", key.to_string_lossy(), value.to_string_lossy()).as_str(); | ||
} | ||
} | ||
result.push_str(command.get_program().to_string_lossy().as_ref()); | ||
|
||
for arg in command.get_args() { | ||
result.push(' '); | ||
result.push_str(arg.to_string_lossy().as_ref()); | ||
} | ||
|
||
result | ||
} | ||
|
||
pub fn print_build_command(contract_name: String, command: &Command) { | ||
let path = command | ||
.get_current_dir() | ||
.expect("missing command dir") | ||
.canonicalize() | ||
.expect("command dir canonicalization failed"); | ||
println!( | ||
"{}\n{}", | ||
format!("Building {} in {} ...", contract_name, path.display()).green(), | ||
format_command(command).green(), | ||
); | ||
} |