✨ feat(cli): add trash command
- Implement a new subcommand `trash` to move emails to trash. - Introduce `trash_cli.rs` to handle the logic for selecting emails to move to trash.
This commit is contained in:
committed by
Jeremiah Russell
parent
f7a8066f66
commit
2035dc7a85
@@ -2,12 +2,15 @@ use clap::{Parser, Subcommand};
|
|||||||
|
|
||||||
mod label_cli;
|
mod label_cli;
|
||||||
mod message_cli;
|
mod message_cli;
|
||||||
|
mod trash_cli;
|
||||||
|
|
||||||
use cull_gmail::Error;
|
use cull_gmail::Error;
|
||||||
use label_cli::LabelCli;
|
use label_cli::LabelCli;
|
||||||
use message_cli::MessageCli;
|
use message_cli::MessageCli;
|
||||||
use std::error::Error as stdError;
|
use std::error::Error as stdError;
|
||||||
|
|
||||||
|
use trash_cli::TrashCli;
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[clap(author, version, about, long_about = None)]
|
#[clap(author, version, about, long_about = None)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
@@ -25,6 +28,9 @@ enum Commands {
|
|||||||
/// List labels
|
/// List labels
|
||||||
#[clap(name = "label")]
|
#[clap(name = "label")]
|
||||||
Labels(LabelCli),
|
Labels(LabelCli),
|
||||||
|
/// List trash
|
||||||
|
#[clap(name = "trash")]
|
||||||
|
Trash(TrashCli),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
@@ -55,6 +61,7 @@ async fn run(args: Cli) -> Result<(), Error> {
|
|||||||
match cmds {
|
match cmds {
|
||||||
Commands::Message(list_cli) => list_cli.run("credential.json").await?,
|
Commands::Message(list_cli) => list_cli.run("credential.json").await?,
|
||||||
Commands::Labels(label_cli) => label_cli.run("credential.json").await?,
|
Commands::Labels(label_cli) => label_cli.run("credential.json").await?,
|
||||||
|
Commands::Trash(trash_cli) => trash_cli.run("credential.json").await?,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user