Print help-text when no command given
This commit is contained in:
parent
d04aecc6ad
commit
1a425fb019
1 changed files with 19 additions and 19 deletions
38
src/main.rs
38
src/main.rs
|
|
@ -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,26 +48,26 @@ 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);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Command::ListLectures(options) => {
|
}
|
||||||
for l in list_lectures(&conf, options)? {
|
Command::ListLectures(options) => {
|
||||||
println!("{:?}", l);
|
for l in list_lectures(&conf, options)? {
|
||||||
}
|
println!("{:?}", l);
|
||||||
}
|
}
|
||||||
Command::AddCourse(course) => add(course, &conf, args.debug)?,
|
}
|
||||||
Command::AddLecture => (),
|
Command::AddCourse(course) => add(course, &conf, args.debug)?,
|
||||||
Command::SelectCourse(options) => rofi::select_course(&conf, &options)?,
|
Command::AddLecture => (),
|
||||||
Command::SelectLecture => (),
|
Command::SelectCourse(options) => rofi::select_course(&conf, &options)?,
|
||||||
Command::Init => (),
|
Command::SelectLecture => (),
|
||||||
Command::Check(list_options) => Course::check(&conf, &list_options)?,
|
Command::Init => (),
|
||||||
Command::Meetings(options) => rofi::select_meeting(&conf, &options)?,
|
Command::Check(list_options) => Course::check(&conf, &list_options)?,
|
||||||
},
|
Command::Meetings(options) => rofi::select_meeting(&conf, &options)?,
|
||||||
None => println!("No command given"),
|
//},
|
||||||
|
// None => println!("No command given"),
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue