Skip to content

Commit db87d5f

Browse files
authored
feat: add headless arg to install (#154)
adds a headless option to the install command bypassing user prompts. this is useful when used in ci
1 parent 7ffbaca commit db87d5f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

crates/svm-rs/src/bin/svm-bin/install.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ use semver::Version;
88
pub struct InstallCmd {
99
/// Solc versions to install.
1010
pub versions: Vec<String>,
11+
12+
/// Run in non interactive mode without prompting for user input.
13+
#[arg(long, default_value_t = false)]
14+
pub non_interactive: bool,
1115
}
1216

1317
impl InstallCmd {
@@ -21,6 +25,9 @@ impl InstallCmd {
2125

2226
if installed_versions.contains(&version) {
2327
println!("Solc {version} is already installed");
28+
if self.non_interactive {
29+
continue;
30+
}
2431
let input: String = Input::new()
2532
.with_prompt("Would you like to set it as the global version?")
2633
.with_initial_text("Y")
@@ -57,7 +64,8 @@ mod tests {
5764
assert_eq!(
5865
args,
5966
InstallCmd {
60-
versions: vec!["0.8.11".into(), "0.8.10".into()]
67+
versions: vec!["0.8.11".into(), "0.8.10".into()],
68+
non_interactive: false,
6169
}
6270
);
6371
}

0 commit comments

Comments
 (0)