diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..b5474f6 --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,31 @@ +use clap::{Args, Parser, Subcommand}; + +#[derive(Debug, Parser)] +#[command(version, about = "a cli to change git users")] +pub struct Cli { + #[command(subcommand)] + command: Commands, +} + +#[derive(Debug, Subcommand)] +pub enum Commands { + List, + Use(UseArgs), + Add(AddArgs), +} + +#[derive(Debug, Args)] +pub struct UseArgs { + pub profile_name: String, + #[arg(short, long)] + pub global: bool, +} + +#[derive(Debug, Args)] +pub struct AddArgs { + pub profile_name: String, + #[arg(long)] + pub name: String, + #[arg(long)] + pub email: String, +} diff --git a/src/main.rs b/src/main.rs index 7406ad9..ab49348 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,8 @@ +use clap::Parser; + +mod cli; + fn main() { - println!("Hello, git!"); + let args = cli::Cli::parse(); + println!("{:?}", args); }