make it compile again

This commit is contained in:
Carson McManus 2022-06-19 10:56:52 -04:00
parent 14d49d33b1
commit 2f4d1e3cfa

View file

@ -233,9 +233,9 @@ fn run() -> anyhow::Result<()> {
} }
} }
match new_args.sub { match &new_args.sub {
Some(cli::Subcommands::Setup{ username }) => { Some(cli::Subcommands::Setup{ username }) => {
do_subcmd_setup(new_args.sub.unwrap().into(), &mut manifest)?; return do_subcmd_setup(new_args.sub.unwrap().into(), &mut manifest);
}, },
Some(cli::Subcommands::Import { files }) => {todo!()}, Some(cli::Subcommands::Import { files }) => {todo!()},
Some(cli::Subcommands::Encrypt {}) => {todo!()}, Some(cli::Subcommands::Encrypt {}) => {todo!()},
@ -320,9 +320,8 @@ fn run() -> anyhow::Result<()> {
.collect::<Vec<String>>() .collect::<Vec<String>>()
); );
if let Some(subcmd) = new_args.sub { match new_args.sub.as_ref() {
match subcmd { Some(cli::Subcommands::Trade{ accept_all, fail_fast }) => {
cli::Subcommands::Trade{ accept_all, fail_fast } => {
for a in selected_accounts.iter_mut() { for a in selected_accounts.iter_mut() {
let mut account = a.lock().unwrap(); let mut account = a.lock().unwrap();
@ -342,14 +341,14 @@ fn run() -> anyhow::Result<()> {
} }
let mut any_failed = false; let mut any_failed = false;
if accept_all { if *accept_all {
info!("accepting all confirmations"); info!("accepting all confirmations");
for conf in &confirmations { for conf in &confirmations {
let result = account.accept_confirmation(conf); let result = account.accept_confirmation(conf);
if result.is_err() { if result.is_err() {
warn!("accept confirmation result: {:?}", result); warn!("accept confirmation result: {:?}", result);
any_failed = true; any_failed = true;
if fail_fast { if *fail_fast {
return result; return result;
} }
} else { } else {
@ -364,7 +363,7 @@ fn run() -> anyhow::Result<()> {
if result.is_err() { if result.is_err() {
warn!("accept confirmation result: {:?}", result); warn!("accept confirmation result: {:?}", result);
any_failed = true; any_failed = true;
if fail_fast { if *fail_fast {
return result; return result;
} }
} else { } else {
@ -377,7 +376,7 @@ fn run() -> anyhow::Result<()> {
if result.is_err() { if result.is_err() {
warn!("deny confirmation result: {:?}", result); warn!("deny confirmation result: {:?}", result);
any_failed = true; any_failed = true;
if fail_fast { if *fail_fast {
return result; return result;
} }
} else { } else {
@ -399,7 +398,7 @@ fn run() -> anyhow::Result<()> {
manifest.save()?; manifest.save()?;
}, },
cli::Subcommands::Remove { username } => { Some(cli::Subcommands::Remove { username }) => {
println!( println!(
"This will remove the mobile authenticator from {} accounts: {}", "This will remove the mobile authenticator from {} accounts: {}",
selected_accounts.len(), selected_accounts.len(),
@ -457,11 +456,12 @@ fn run() -> anyhow::Result<()> {
manifest.save()?; manifest.save()?;
}, },
s => { Some(s) => {
error!("Unknown subcommand: {:?}", s); error!("Unknown subcommand: {:?}", s);
}, },
} _ => {
} else { debug!("No subcommand given, assuming user wants a 2fa code");
let server_time = steamapi::get_server_time(); let server_time = steamapi::get_server_time();
debug!("Time used to generate codes: {}", server_time); debug!("Time used to generate codes: {}", server_time);
for account in selected_accounts { for account in selected_accounts {
@ -474,6 +474,7 @@ fn run() -> anyhow::Result<()> {
println!("{}", code); println!("{}", code);
} }
} }
}
Ok(()) Ok(())
} }