keyfork-derive-openpgp: use run-fn style
This commit is contained in:
parent
bc5bd8a7b9
commit
008390d087
|
@ -1,4 +1,4 @@
|
|||
use std::{env, str::FromStr};
|
||||
use std::{env, str::FromStr, process::ExitCode};
|
||||
|
||||
use keyfork_derive_util::{
|
||||
request::{DerivationAlgorithm, DerivationRequest},
|
||||
|
@ -97,7 +97,7 @@ fn validate(
|
|||
Ok((path, subkey_format, UserID::from(default_userid)))
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut args = env::args();
|
||||
let program_name = args.next().expect("program name");
|
||||
let args = args.collect::<Vec<_>>();
|
||||
|
@ -130,3 +130,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() -> ExitCode {
|
||||
if let Err(e) = run() {
|
||||
eprintln!("Error: {e}");
|
||||
ExitCode::FAILURE
|
||||
} else {
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue