Skip to content

Commit 8fb1df8

Browse files
feat(cli): add --ci flag to signer generate, closes #6089 (#6097)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent e0631d3 commit 8fb1df8

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
Add `--ci` flag and respect the `CI` environment variable on the `signer generate` command. In this case the default password will be an empty string and the CLI will not prompt for a value.

tooling/cli/src/signer/generate.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ pub struct Options {
2121
/// Overwrite private key even if it exists on the specified path
2222
#[clap(short, long)]
2323
force: bool,
24+
/// Skip prompting for values
25+
#[clap(short, long)]
26+
ci: bool,
2427
}
2528

26-
pub fn command(options: Options) -> Result<()> {
27-
if options.password.is_none() {
28-
println!("Generating new private key without password.")
29+
pub fn command(mut options: Options) -> Result<()> {
30+
options.ci = options.ci || std::env::var("CI").is_ok();
31+
32+
if options.ci && options.password.is_none() {
33+
println!("Generating new private key without password.");
34+
options.password.replace("".into());
2935
}
3036
let keypair = generate_key(options.password).expect("Failed to generate key");
3137

0 commit comments

Comments
 (0)