From 1826a839e7299e6d5c14661fe586a1127b6a2a8b Mon Sep 17 00:00:00 2001 From: Jana Lemke Date: Wed, 24 May 2023 11:11:12 +0200 Subject: [PATCH] Print help-text when no command given --- src/main.rs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main.rs b/src/main.rs index dbef314..14f953f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ struct Cli { #[structopt(short, long)] debug: bool, #[structopt(subcommand)] - cmd: Option, + cmd: Command, } #[derive(StructOpt)] @@ -48,26 +48,26 @@ fn main() -> Result<()> { }; let args = Cli::from_args(); match args.cmd { - Some(subcommand) => match subcommand { - Command::ListCourses(options) => { - for c in Course::list(&conf, &options)?.iter() { - println!("{}", c); - } + // Some(subcommand) => match subcommand { + Command::ListCourses(options) => { + for c in Course::list(&conf, &options)?.iter() { + println!("{}", c); } - Command::ListLectures(options) => { - for l in list_lectures(&conf, options)? { - println!("{:?}", l); - } + } + Command::ListLectures(options) => { + for l in list_lectures(&conf, options)? { + println!("{:?}", l); } - Command::AddCourse(course) => add(course, &conf, args.debug)?, - Command::AddLecture => (), - Command::SelectCourse(options) => rofi::select_course(&conf, &options)?, - Command::SelectLecture => (), - Command::Init => (), - Command::Check(list_options) => Course::check(&conf, &list_options)?, - Command::Meetings(options) => rofi::select_meeting(&conf, &options)?, - }, - None => println!("No command given"), + } + Command::AddCourse(course) => add(course, &conf, args.debug)?, + Command::AddLecture => (), + Command::SelectCourse(options) => rofi::select_course(&conf, &options)?, + Command::SelectLecture => (), + Command::Init => (), + Command::Check(list_options) => Course::check(&conf, &list_options)?, + Command::Meetings(options) => rofi::select_meeting(&conf, &options)?, + //}, + // None => println!("No command given"), }; Ok(()) }