From 0515ab54430210044c07d23f229b077c8b7acdba Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Mon, 4 Mar 2024 06:49:38 -0500 Subject: [PATCH] rename `trade` subcommand to `confirm` and deprecate `trade` subcommand --- README.md | 2 +- src/commands.rs | 7 ++++--- src/commands/{trade.rs => confirm.rs} | 14 +++++++------- src/main.rs | 2 +- steamguard/src/confirmation.rs | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) rename src/commands/{trade.rs => confirm.rs} (90%) diff --git a/README.md b/README.md index 88fb8eb3..2a938222 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Lint, Build, Test](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml) [![AUR Tester](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml) -A command line utility for setting up and using Steam Mobile Authenticator (AKA Steam 2FA). It can also be used to respond to trade and market confirmations. +A command line utility for setting up and using Steam Mobile Authenticator (AKA Steam 2FA). It can also be used to respond to trade, market, and any other steam mobile confirmations that you would normally get in the app. **The only legitimate place to download steamguard-cli binaries is through this repo's releases, or by any package manager that is linked in this document.** diff --git a/src/commands.rs b/src/commands.rs index fca7cd4f..e57c7538 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -10,6 +10,7 @@ use crate::AccountManager; pub mod code; pub mod completions; +pub mod confirm; pub mod debug; pub mod decrypt; pub mod encrypt; @@ -19,10 +20,10 @@ pub mod qr; pub mod qr_login; pub mod remove; pub mod setup; -pub mod trade; pub use code::CodeCommand; pub use completions::CompletionsCommand; +pub use confirm::ConfirmCommand; pub use debug::DebugCommand; pub use decrypt::DecryptCommand; pub use encrypt::EncryptCommand; @@ -32,7 +33,6 @@ pub use qr::QrCommand; pub use qr_login::QrLoginCommand; pub use remove::RemoveCommand; pub use setup::SetupCommand; -pub use trade::TradeCommand; /// A command that does not operate on the manifest or individual accounts. pub(crate) trait ConstCommand { @@ -166,7 +166,8 @@ pub(crate) enum Subcommands { Completion(CompletionsCommand), Setup(SetupCommand), Import(ImportCommand), - Trade(TradeCommand), + #[clap(alias = "trade")] + Confirm(ConfirmCommand), Remove(RemoveCommand), Encrypt(EncryptCommand), Decrypt(DecryptCommand), diff --git a/src/commands/trade.rs b/src/commands/confirm.rs similarity index 90% rename from src/commands/trade.rs rename to src/commands/confirm.rs index 4aaab6be..ddeacf21 100644 --- a/src/commands/trade.rs +++ b/src/commands/confirm.rs @@ -9,12 +9,12 @@ use crate::{tui, AccountManager}; use super::*; #[derive(Debug, Clone, Parser)] -#[clap(about = "Interactive interface for trade confirmations")] -pub struct TradeCommand { +#[clap(about = "Interactive interface for steam mobile confirmations")] +pub struct ConfirmCommand { #[clap( short, long, - help = "Accept all open trade confirmations. Does not open interactive interface." + help = "Accept all open mobile confirmations. Does not open interactive interface." )] pub accept_all: bool, #[clap( @@ -25,7 +25,7 @@ pub struct TradeCommand { pub fail_fast: bool, } -impl AccountCommand for TradeCommand +impl AccountCommand for ConfirmCommand where T: Transport + Clone, { @@ -44,12 +44,12 @@ where crate::do_login(transport.clone(), &mut account, args.password.clone())?; } - info!("{}: Checking for trade confirmations", account.account_name); + info!("{}: Checking for confirmations", account.account_name); let confirmations: Vec; loop { let confirmer = Confirmer::new(transport.clone(), &account); - match confirmer.get_trade_confirmations() { + match confirmer.get_confirmations() { Ok(confs) => { confirmations = confs; break; @@ -59,7 +59,7 @@ where crate::do_login(transport.clone(), &mut account, args.password.clone())?; } Err(err) => { - error!("Failed to get trade confirmations: {}", err); + error!("Failed to get confirmations: {}", err); return Err(err.into()); } } diff --git a/src/main.rs b/src/main.rs index 86f24b9e..cdb4d84f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,7 +86,7 @@ fn run(args: commands::Args) -> anyhow::Result<()> { Subcommands::Import(args) => CommandType::Manifest(Box::new(args)), Subcommands::Encrypt(args) => CommandType::Manifest(Box::new(args)), Subcommands::Decrypt(args) => CommandType::Manifest(Box::new(args)), - Subcommands::Trade(args) => CommandType::Account(Box::new(args)), + Subcommands::Confirm(args) => CommandType::Account(Box::new(args)), Subcommands::Remove(args) => CommandType::Account(Box::new(args)), Subcommands::Code(args) => CommandType::Account(Box::new(args)), #[cfg(feature = "qr")] diff --git a/steamguard/src/confirmation.rs b/steamguard/src/confirmation.rs index 2f8ed821..1dc247e1 100644 --- a/steamguard/src/confirmation.rs +++ b/steamguard/src/confirmation.rs @@ -82,7 +82,7 @@ where cookies } - pub fn get_trade_confirmations(&self) -> Result, ConfirmerError> { + pub fn get_confirmations(&self) -> Result, ConfirmerError> { let cookies = self.build_cookie_jar(); let client = self.transport.innner_http_client()?;