diff --git a/.gitignore b/.gitignore index ea8c4bf..730eac4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,13 @@ -/target +### Rust ### +# Generated by Cargo +# will have compiled files and executables +target/** + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# End of https://www.toptal.com/developers/gitignore/api/rust diff --git a/src/app.rs b/src/app.rs index fcc540e..b5cffe3 100644 --- a/src/app.rs +++ b/src/app.rs @@ -278,6 +278,9 @@ impl App { self.export_headers(); } pub fn next(&mut self) { + if self.tasks.len() == 0 { + return + } let i = match self.state.selected() { Some(i) => { if i >= self.tasks.len() - 1 { @@ -291,6 +294,9 @@ impl App { self.state.select(Some(i)); } pub fn previous(&mut self) { + if self.tasks.len() == 0 { + return + } let i = match self.state.selected() { Some(i) => { if i == 0 { @@ -344,6 +350,7 @@ impl App { pub fn export_tasks(&mut self) { let mut task = Command::new("task"); + task.arg("rc.json.array=on"); task.arg("export"); match split(&self.filter) { @@ -417,6 +424,8 @@ mod tests { let mut app = App::new(); app.update(); + println!("{:?}", app.tasks); + println!("{:?}", app.task_report_columns); println!("{:?}", app.task_report_labels);