Add r621cli
This commit is contained in:
parent
0b960749fe
commit
982fcb36ec
3 changed files with 46 additions and 1 deletions
|
@ -4,3 +4,4 @@ version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
clap = { version = "4.5.42", features = ["derive"] }
|
||||||
|
|
30
r621cli/src/cli.rs
Normal file
30
r621cli/src/cli.rs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
use clap::{Parser, Subcommand, ValueEnum};
|
||||||
|
|
||||||
|
#[derive(Parser, Clone, Debug)]
|
||||||
|
#[command(version, name = "r621cli")]
|
||||||
|
pub struct Cli {
|
||||||
|
#[arg(value_enum)]
|
||||||
|
pub esix_type: ESixType,
|
||||||
|
|
||||||
|
#[clap(subcommand)]
|
||||||
|
pub action: Action,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Subcommand, Clone, Debug)]
|
||||||
|
pub enum Action {
|
||||||
|
Create,
|
||||||
|
Delete,
|
||||||
|
Favorite,
|
||||||
|
Search {
|
||||||
|
query: String
|
||||||
|
},
|
||||||
|
Vote
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(ValueEnum, Clone, Debug)]
|
||||||
|
pub enum ESixType {
|
||||||
|
Note,
|
||||||
|
Pool,
|
||||||
|
Post
|
||||||
|
}
|
|
@ -1,3 +1,17 @@
|
||||||
|
mod cli;
|
||||||
|
|
||||||
|
use cli::{Cli, Action, ESixType};
|
||||||
|
use clap::Parser;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world!");
|
let cli = Cli::parse();
|
||||||
|
|
||||||
|
match (&cli.esix_type, &cli.action) {
|
||||||
|
(ESixType::Post, Action::Search {query}) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
todo!("{:?} not implemented for {:?}", &cli.action, &cli.esix_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue