-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement the shell of the CLI API
- Loading branch information
1 parent
c2a51ad
commit ec385d1
Showing
1 changed file
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |