diff --git a/CHANGELOG.md b/CHANGELOG.md index 17285e53..bfc8a428 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Added `-y|--yes` flag for `folder purge` and `folder delete` commands. [#469] + ### Changed - Put back `warn` the default log level. [#522] @@ -951,6 +955,7 @@ Few major concepts changed: [0.2.0]: https://github.com/soywod/himalaya/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/soywod/himalaya/releases/tag/v0.1.0 +[#469]: https://github.com/pimalaya/himalaya/issues/469 [#492]: https://github.com/pimalaya/himalaya/issues/492 [#496]: https://github.com/pimalaya/himalaya/issues/496 [#508]: https://github.com/pimalaya/himalaya/issues/508 diff --git a/Cargo.lock b/Cargo.lock index d91c6c8a..b88bb960 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1200,11 +1200,12 @@ dependencies = [ [[package]] name = "email-lib" version = "0.26.2" -source = "git+https://github.com/pimalaya/core#54aa97e39768ee8b6482fea7560bd15daadfa739" +source = "git+https://github.com/pimalaya/core#09c2283c54e37b99450a63b1285944456ba19ebc" dependencies = [ "async-trait", "chrono", "chumsky", + "dirs", "email-macros", "email_address", "futures", @@ -1828,7 +1829,7 @@ dependencies = [ [[package]] name = "http-lib" version = "0.1.0" -source = "git+https://github.com/pimalaya/core#54aa97e39768ee8b6482fea7560bd15daadfa739" +source = "git+https://github.com/pimalaya/core#09c2283c54e37b99450a63b1285944456ba19ebc" dependencies = [ "thiserror 1.0.69", "tokio", @@ -2274,7 +2275,7 @@ dependencies = [ [[package]] name = "keyring-lib" version = "1.0.2" -source = "git+https://github.com/pimalaya/core#54aa97e39768ee8b6482fea7560bd15daadfa739" +source = "git+https://github.com/pimalaya/core#09c2283c54e37b99450a63b1285944456ba19ebc" dependencies = [ "keyring", "once_cell", @@ -2599,7 +2600,7 @@ dependencies = [ [[package]] name = "mml-lib" version = "1.1.1" -source = "git+https://github.com/pimalaya/core#54aa97e39768ee8b6482fea7560bd15daadfa739" +source = "git+https://github.com/pimalaya/core#09c2283c54e37b99450a63b1285944456ba19ebc" dependencies = [ "async-recursion", "chumsky", @@ -2798,7 +2799,7 @@ dependencies = [ [[package]] name = "oauth-lib" version = "2.0.0" -source = "git+https://github.com/pimalaya/core#54aa97e39768ee8b6482fea7560bd15daadfa739" +source = "git+https://github.com/pimalaya/core#09c2283c54e37b99450a63b1285944456ba19ebc" dependencies = [ "http-lib", "oauth2", @@ -3082,7 +3083,7 @@ dependencies = [ [[package]] name = "pgp-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#54aa97e39768ee8b6482fea7560bd15daadfa739" +source = "git+https://github.com/pimalaya/core#09c2283c54e37b99450a63b1285944456ba19ebc" dependencies = [ "async-recursion", "futures", @@ -3261,7 +3262,7 @@ dependencies = [ [[package]] name = "process-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#54aa97e39768ee8b6482fea7560bd15daadfa739" +source = "git+https://github.com/pimalaya/core#09c2283c54e37b99450a63b1285944456ba19ebc" dependencies = [ "serde", "thiserror 1.0.69", @@ -3737,7 +3738,7 @@ dependencies = [ [[package]] name = "secret-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#54aa97e39768ee8b6482fea7560bd15daadfa739" +source = "git+https://github.com/pimalaya/core#09c2283c54e37b99450a63b1285944456ba19ebc" dependencies = [ "keyring-lib", "process-lib", diff --git a/src/folder/command/delete.rs b/src/folder/command/delete.rs index dccde3bd..b03b7bc9 100644 --- a/src/folder/command/delete.rs +++ b/src/folder/command/delete.rs @@ -27,6 +27,9 @@ pub struct FolderDeleteCommand { #[command(flatten)] pub account: AccountNameFlag, + + #[arg(long, short)] + pub yes: bool, } impl FolderDeleteCommand { @@ -35,12 +38,14 @@ impl FolderDeleteCommand { let folder = &self.folder.name; - let confirm = format!("Do you really want to delete the folder {folder}"); - let confirm = format!("{confirm}? All emails will be definitely deleted."); + if !self.yes { + let confirm = format!("Do you really want to delete the folder {folder}"); + let confirm = format!("{confirm}? All emails will be definitely deleted."); - if !prompt::bool(confirm, false)? { - process::exit(0); - }; + if !prompt::bool(confirm, false)? { + process::exit(0); + }; + } let (toml_account_config, account_config) = config .clone() diff --git a/src/folder/command/purge.rs b/src/folder/command/purge.rs index 91bf046d..4a185de4 100644 --- a/src/folder/command/purge.rs +++ b/src/folder/command/purge.rs @@ -24,6 +24,9 @@ pub struct FolderPurgeCommand { #[command(flatten)] pub account: AccountNameFlag, + + #[arg(long, short)] + pub yes: bool, } impl FolderPurgeCommand { @@ -32,11 +35,13 @@ impl FolderPurgeCommand { let folder = &self.folder.name; - let confirm = format!("Do you really want to purge the folder {folder}"); - let confirm = format!("{confirm}? All emails will be definitely deleted."); + if !self.yes { + let confirm = format!("Do you really want to purge the folder {folder}"); + let confirm = format!("{confirm}? All emails will be definitely deleted."); - if !prompt::bool(confirm, false)? { - process::exit(0); + if !prompt::bool(confirm, false)? { + process::exit(0); + }; }; let (toml_account_config, account_config) = config