feat(cli): add --ci flag to signer generate, closes #6089 (#6097)

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
Amr Bashir
2023-01-19 04:43:37 +02:00
committed by GitHub
parent e0631d379c
commit 8fb1df8aa6
2 changed files with 15 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
---
"cli.rs": patch
"cli.js": patch
---
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.

View File

@@ -21,11 +21,17 @@ pub struct Options {
/// Overwrite private key even if it exists on the specified path
#[clap(short, long)]
force: bool,
/// Skip prompting for values
#[clap(short, long)]
ci: bool,
}
pub fn command(options: Options) -> Result<()> {
if options.password.is_none() {
println!("Generating new private key without password.")
pub fn command(mut options: Options) -> Result<()> {
options.ci = options.ci || std::env::var("CI").is_ok();
if options.ci && options.password.is_none() {
println!("Generating new private key without password.");
options.password.replace("".into());
}
let keypair = generate_key(options.password).expect("Failed to generate key");