Fast, keyboard-first command line client for CodeHub.
main
| 1 | use clap::{Parser, Subcommand}; |
| 2 | |
| 3 | #[derive(Parser)] |
| 4 | #[command(name = "codehub", about = "CodeHub from your terminal")] |
| 5 | struct Cli { |
| 6 | #[command(subcommand)] |
| 7 | command: Commands, |
| 8 | } |
| 9 | |
| 10 | #[derive(Subcommand)] |
| 11 | enum Commands { |
| 12 | Repo { name: String }, |
| 13 | Issue { number: u32 }, |
| 14 | } |
| 15 | |
| 16 | fn main() { |
| 17 | let cli = Cli::parse(); |
| 18 | match cli.command { |
| 19 | Commands::Repo { name } => println!("Opening {name}"), |
| 20 | Commands::Issue { number } => println!("Issue #{number}"), |
| 21 | } |
| 22 | } |
| 23 |
23 lines · 481 bytesLast updated 3 days ago