Merge branch 'implement-config-subcommand' of github.com:jerus-org/cull-gmail
This commit is contained in:
committed by
Jeremiah Russell
parent
c68d34867e
commit
782cfc4baf
2
PRLOG.md
2
PRLOG.md
@@ -99,8 +99,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
[#28]: https://github.com/jerus-org/cull-gmail/pull/28
|
||||
[#29]: https://github.com/jerus-org/cull-gmail/pull/29
|
||||
[#30]: https://github.com/jerus-org/cull-gmail/pull/30
|
||||
[#33]: https://github.com/jerus-org/cull-gmail/pull/33
|
||||
[Unreleased]: https://github.com/jerus-org/cull-gmail/compare/v0.0.4...HEAD
|
||||
[0.0.4]: https://github.com/jerus-org/cull-gmail/compare/v0.0.3...v0.0.4
|
||||
[0.0.3]: https://github.com/jerus-org/cull-gmail/compare/v0.0.2...v0.0.3
|
||||
[0.0.2]: https://github.com/jerus-org/cull-gmail/compare/v0.0.1...v0.0.2
|
||||
|
||||
35
src/config_cli.rs
Normal file
35
src/config_cli.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct ConfigCli {
|
||||
/// Configuration commands
|
||||
#[command(subcommand)]
|
||||
command: ConfigCommands,
|
||||
}
|
||||
|
||||
impl ConfigCli {
|
||||
pub fn run(&self) {
|
||||
match self.command {
|
||||
ConfigCommands::List => todo!(),
|
||||
ConfigCommands::Add => todo!(),
|
||||
ConfigCommands::Remove => todo!(),
|
||||
ConfigCommands::Update => todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum ConfigCommands {
|
||||
/// List the rules configured and saved in the config file
|
||||
#[clap(name = "list")]
|
||||
List,
|
||||
/// Add a rules to the config file
|
||||
#[clap(name = "add")]
|
||||
Add,
|
||||
/// Remove a rule from the config file
|
||||
#[clap(name = "remove", alias = "rm")]
|
||||
Remove,
|
||||
/// Update a rule in the config file
|
||||
#[clap(name = "update")]
|
||||
Update,
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
mod config_cli;
|
||||
mod label_cli;
|
||||
mod message_cli;
|
||||
mod trash_cli;
|
||||
|
||||
use config_cli::ConfigCli;
|
||||
use cull_gmail::Error;
|
||||
use label_cli::LabelCli;
|
||||
use message_cli::MessageCli;
|
||||
@@ -28,9 +30,12 @@ enum Commands {
|
||||
/// List labels
|
||||
#[clap(name = "label")]
|
||||
Labels(LabelCli),
|
||||
/// List trash
|
||||
/// Move messages to trash
|
||||
#[clap(name = "trash")]
|
||||
Trash(TrashCli),
|
||||
/// Configure end-of-life rules
|
||||
#[clap(name = "config")]
|
||||
Config(ConfigCli),
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -62,6 +67,7 @@ async fn run(args: Cli) -> Result<(), Error> {
|
||||
Commands::Message(list_cli) => list_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?,
|
||||
Commands::Config(config_cli) => config_cli.run(),
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user