Have basic structure down

This commit is contained in:
breadone 2024-03-10 16:15:05 +13:00
parent f72bc5518b
commit 45027ad826
No known key found for this signature in database

View File

@ -1,3 +1,53 @@
fn main() { use clap::{Parser, Subcommand};
println!("Hello, world!");
#[derive(Subcommand)]
enum Command {
Git {
#[command(subcommand)]
git_command: GitCommand
}
} }
#[derive(Subcommand)]
enum GitCommand {
Create {
#[arg()]
name: String
},
List,
Delete {
#[arg()]
name: String
}
}
#[derive(Parser)]
struct Cli {
#[command(subcommand)]
command: Command
}
fn main() {
let args = Cli::parse();
match &args.command {
Command::Git { git_command } => {
handle_git(&git_command);
}
}
}
fn handle_git(cmd: &GitCommand) {
match cmd {
GitCommand::Create { name } => {
println!("{}", name);
}
_ => {
println!("oopsies")
}
}
}