diff --git a/Cargo.toml b/Cargo.toml index 31d5b26..50d5dc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +clap = {version = "*", features = ["derive"]} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index e7a11a9..07b5b1b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,22 @@ -fn main() { - println!("Hello, world!"); +use clap::{Parser, Subcommand, CommandFactory, ErrorKind}; + + +#[derive(Parser)] +struct Cli { + #[clap(subcommand)] + command: Option } + +#[derive(Subcommand)] +enum Commands { + Help +} + +fn main() { + let cli = Cli::parse(); + + match &cli.command { + Some(Commands::Help) => Cli::command().error(ErrorKind::DisplayHelp, ""), + None => Cli::command().error(ErrorKind::DisplayHelp, "") + }; +} \ No newline at end of file