Add default report command line argument

This commit is contained in:
Dheepak Krishnamurthy 2021-04-28 12:25:16 -06:00
parent 73a3dca579
commit 00989a0eb5
4 changed files with 36 additions and 19 deletions

View file

@ -70,21 +70,30 @@ fn main() {
.help("Sets a custom config file")
.takes_value(true),
)
.arg(
Arg::with_name("report")
.short("r")
.long("report")
.value_name("STRING")
.help("Sets default report")
.takes_value(true),
)
.get_matches();
let config = matches.value_of("config").unwrap_or("~/.taskrc");
task::block_on(tui_main(config)).expect(
let report = matches.value_of("report").unwrap_or("next");
task::block_on(tui_main(config, report)).expect(
"[taskwarrior-tui error]. Please report as a github issue on https://github.com/kdheepak/taskwarrior-tui",
);
}
async fn tui_main(_config: &str) -> Result<()> {
async fn tui_main(_config: &str, report: &str) -> Result<()> {
panic::set_hook(Box::new(|panic_info| {
destruct_terminal();
better_panic::Settings::auto().create_panic_handler()(panic_info);
}));
let maybeapp = TaskwarriorTuiApp::new();
let maybeapp = TaskwarriorTuiApp::new(report);
if maybeapp.is_err() {
destruct_terminal();
return Err(maybeapp.err().unwrap());