mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-22 02:50:19 +00:00
turn folder arg into flag for message copy, move and delete cmds
This commit is contained in:
parent
c11f00d791
commit
f398eb0d30
4 changed files with 10 additions and 9 deletions
|
@ -8,7 +8,7 @@ use crate::{
|
|||
cache::arg::disable::CacheDisableFlag,
|
||||
config::TomlConfig,
|
||||
envelope::arg::ids::EnvelopeIdsArgs,
|
||||
folder::arg::name::{SourceFolderNameArg, TargetFolderNameArg},
|
||||
folder::arg::name::{SourceFolderNameOptionalFlag, TargetFolderNameArg},
|
||||
printer::Printer,
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,7 @@ use crate::{
|
|||
#[derive(Debug, Parser)]
|
||||
pub struct MessageCopyCommand {
|
||||
#[command(flatten)]
|
||||
pub source_folder: SourceFolderNameArg,
|
||||
pub source_folder: SourceFolderNameOptionalFlag,
|
||||
|
||||
#[command(flatten)]
|
||||
pub target_folder: TargetFolderNameArg,
|
||||
|
|
|
@ -44,6 +44,6 @@ impl MessageDeleteCommand {
|
|||
let ids = &self.envelopes.ids;
|
||||
backend.delete_messages(folder, ids).await?;
|
||||
|
||||
printer.print("Message(s) successfully deleted from {from_folder} to {to_folder}!")
|
||||
printer.print(format!("Message(s) successfully removed from {folder}!"))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
|||
cache::arg::disable::CacheDisableFlag,
|
||||
config::TomlConfig,
|
||||
envelope::arg::ids::EnvelopeIdsArgs,
|
||||
folder::arg::name::{SourceFolderNameArg, TargetFolderNameArg},
|
||||
folder::arg::name::{SourceFolderNameOptionalFlag, TargetFolderNameArg},
|
||||
printer::Printer,
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,7 @@ use crate::{
|
|||
#[derive(Debug, Parser)]
|
||||
pub struct MessageMoveCommand {
|
||||
#[command(flatten)]
|
||||
pub source_folder: SourceFolderNameArg,
|
||||
pub source_folder: SourceFolderNameOptionalFlag,
|
||||
|
||||
#[command(flatten)]
|
||||
pub target_folder: TargetFolderNameArg,
|
||||
|
|
|
@ -26,11 +26,12 @@ pub struct FolderNameArg {
|
|||
pub name: String,
|
||||
}
|
||||
|
||||
/// The source folder name argument parser.
|
||||
/// The optional source folder name flag parser.
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct SourceFolderNameArg {
|
||||
pub struct SourceFolderNameOptionalFlag {
|
||||
/// The name of the source folder.
|
||||
#[arg(name = "from-folder-name", value_name = "FROM")]
|
||||
#[arg(long = "folder", short = 'f')]
|
||||
#[arg(name = "source_folder_name", value_name = "SOURCE", default_value = INBOX)]
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
|
@ -38,6 +39,6 @@ pub struct SourceFolderNameArg {
|
|||
#[derive(Debug, Parser)]
|
||||
pub struct TargetFolderNameArg {
|
||||
/// The name of the target folder.
|
||||
#[arg(name = "to-folder-name", value_name = "TO")]
|
||||
#[arg(name = "target_folder_name", value_name = "TARGET")]
|
||||
pub name: String,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue