Skip to content

Commit

Permalink
feat: Implement the shell of the CLI API
Browse files Browse the repository at this point in the history
  • Loading branch information
ducdetronquito committed Dec 23, 2023
1 parent c2a51ad commit ec385d1
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
use clap::{Parser, Subcommand};

#[derive(Parser, Debug)]
#[command(version)]
#[command(about = "🎂 CLI tool to remember birthdays of people you know")]
struct Cli {
#[command(subcommand)]
command: Command,
}

#[derive(Subcommand, Debug)]
enum Command {
#[command(about = "Add a person's birthday")]
Add { name: String, date: String },
#[command(about = "Show all birthdays")]
All {},
#[command(about = "Show the next birthday")]
Next {},

#[command(about = "Search for birthdays")]
#[command(arg_required_else_help(true))]
Search {
#[arg(short, long, help = "match for names containing <NAME>")]
name: Option<String>,
#[arg(short, long, help = "match for a specific <DATE>")]
date: Option<String>,
},
#[command(about = "Show today's birthdays")]
Today {},
}

fn main() {
println!("Hello, world!");
let args = Cli::parse();
println!("You ran cli with: {:?}", args);
}

0 comments on commit ec385d1

Please sign in to comment.