Print help-text when no command given

This commit is contained in:
Jana Lemke 2023-05-24 11:11:12 +02:00
parent 06d283b17c
commit 44b019a7b4

View file

@ -13,7 +13,7 @@ struct Cli {
#[structopt(short, long)] #[structopt(short, long)]
debug: bool, debug: bool,
#[structopt(subcommand)] #[structopt(subcommand)]
cmd: Option<Command>, cmd: Command,
} }
#[derive(StructOpt)] #[derive(StructOpt)]
@ -48,7 +48,7 @@ fn main() -> Result<()> {
}; };
let args = Cli::from_args(); let args = Cli::from_args();
match args.cmd { match args.cmd {
Some(subcommand) => match subcommand { // Some(subcommand) => match subcommand {
Command::ListCourses(options) => { Command::ListCourses(options) => {
for c in Course::list(&conf, &options)?.iter() { for c in Course::list(&conf, &options)?.iter() {
println!("{}", c); println!("{}", c);
@ -66,8 +66,8 @@ fn main() -> Result<()> {
Command::Init => (), Command::Init => (),
Command::Check(list_options) => Course::check(&conf, &list_options)?, Command::Check(list_options) => Course::check(&conf, &list_options)?,
Command::Meetings(options) => rofi::select_meeting(&conf, &options)?, Command::Meetings(options) => rofi::select_meeting(&conf, &options)?,
}, //},
None => println!("No command given"), // None => println!("No command given"),
}; };
Ok(()) Ok(())
} }