mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-24 05:26:42 +02:00
fix: Switch to taskwarrior v3.X backend
This commit is contained in:
parent
4902ecdb34
commit
d178b986ad
4 changed files with 20 additions and 18 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1329,7 +1329,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "taskwarrior-tui"
|
name = "taskwarrior-tui"
|
||||||
version = "0.25.4"
|
version = "0.26.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"better-panic",
|
"better-panic",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "taskwarrior-tui"
|
name = "taskwarrior-tui"
|
||||||
version = "0.25.4"
|
version = "0.26.0"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "A Taskwarrior Terminal User Interface"
|
description = "A Taskwarrior Terminal User Interface"
|
||||||
repository = "https://github.com/kdheepak/taskwarrior-tui/"
|
repository = "https://github.com/kdheepak/taskwarrior-tui/"
|
||||||
|
@ -18,9 +18,7 @@ better-panic = "0.3.0"
|
||||||
cassowary = "0.3.0"
|
cassowary = "0.3.0"
|
||||||
chrono = "0.4.26"
|
chrono = "0.4.26"
|
||||||
clap = { version = "4.4.1", features = ["derive"] }
|
clap = { version = "4.4.1", features = ["derive"] }
|
||||||
crossterm = { version = "0.27.0", features = [
|
crossterm = { version = "0.27.0", features = ["event-stream"] }
|
||||||
"event-stream",
|
|
||||||
] }
|
|
||||||
dirs = "5.0.1"
|
dirs = "5.0.1"
|
||||||
futures = "0.3.28"
|
futures = "0.3.28"
|
||||||
itertools = "0.11.0"
|
itertools = "0.11.0"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# `taskwarrior-tui`
|
# `taskwarrior-tui`
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> `taskwarrior-tui` is only tested with `taskwarrior` v2.x. [`taskwarrior` v3.x](https://github.com/GothenburgBitFactory/taskwarrior/releases/tag/v3.0.0) may not work as intended.
|
> [`taskwarrior` v3.x](https://github.com/GothenburgBitFactory/taskwarrior/releases/tag/v3.0.0) may break `taskwarrior-tui` features in unexpected ways. Please file a bug report if you encounter a bug.
|
||||||
|
|
||||||
[](https://github.com/kdheepak/taskwarrior-tui/actions?query=workflow%3ACI)
|
[](https://github.com/kdheepak/taskwarrior-tui/actions?query=workflow%3ACI)
|
||||||
[](./LICENSE)
|
[](./LICENSE)
|
||||||
|
|
28
src/app.rs
28
src/app.rs
|
@ -64,7 +64,7 @@ const MAX_LINE: usize = 4096;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref START_TIME: Instant = Instant::now();
|
static ref START_TIME: Instant = Instant::now();
|
||||||
static ref TASKWARRIOR_VERSION_SUPPORTED: Versioning = Versioning::new("2.6.0").unwrap();
|
static ref TASKWARRIOR_VERSION_SUPPORTED: Versioning = Versioning::new("3.0.0").unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -1309,7 +1309,6 @@ impl TaskwarriorTui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.last_export = Some(std::time::SystemTime::now());
|
|
||||||
self.task_report_table.export_headers(None, &self.report)?;
|
self.task_report_table.export_headers(None, &self.report)?;
|
||||||
self.export_tasks()?;
|
self.export_tasks()?;
|
||||||
if self.config.uda_task_report_use_all_tasks_for_completion {
|
if self.config.uda_task_report_use_all_tasks_for_completion {
|
||||||
|
@ -1321,6 +1320,10 @@ impl TaskwarriorTui {
|
||||||
self.task_details.clear();
|
self.task_details.clear();
|
||||||
self.dirty = false;
|
self.dirty = false;
|
||||||
self.save_history()?;
|
self.save_history()?;
|
||||||
|
|
||||||
|
// Some operations like export or summary change the taskwarrior database.
|
||||||
|
// The export time therefore gets set at the end, to avoid an infinite update loop.
|
||||||
|
self.last_export = Some(std::time::SystemTime::now());
|
||||||
}
|
}
|
||||||
self.cursor_fix();
|
self.cursor_fix();
|
||||||
self.update_task_table_state();
|
self.update_task_table_state();
|
||||||
|
@ -1608,20 +1611,21 @@ impl TaskwarriorTui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_task_files_max_mtime(&self) -> Result<SystemTime> {
|
fn get_task_database_mtime(&self) -> Result<SystemTime> {
|
||||||
let data_dir = shellexpand::tilde(&self.config.data_location).into_owned();
|
let data_dir = shellexpand::tilde(&self.config.data_location);
|
||||||
["backlog.data", "completed.data", "pending.data"]
|
let database_path = Path::new(data_dir.as_ref()).join("taskchampion.sqlite3");
|
||||||
.iter()
|
|
||||||
.map(|n| fs::metadata(Path::new(&data_dir).join(n)).map(|m| m.modified()))
|
let metadata = fs::metadata(database_path).context("Fetching the metadate of the task database failed")?;
|
||||||
.filter_map(Result::ok)
|
let mtime = metadata
|
||||||
.filter_map(Result::ok)
|
.modified()
|
||||||
.max()
|
.context("Could not get mtime of task database, but fetching metadata succeeded")?;
|
||||||
.ok_or_else(|| anyhow!("Unable to get task files max time"))
|
|
||||||
|
Ok(mtime)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tasks_changed_since(&mut self, prev: Option<SystemTime>) -> Result<bool> {
|
pub fn tasks_changed_since(&mut self, prev: Option<SystemTime>) -> Result<bool> {
|
||||||
if let Some(prev) = prev {
|
if let Some(prev) = prev {
|
||||||
let mtime = self.get_task_files_max_mtime()?;
|
let mtime = self.get_task_database_mtime()?;
|
||||||
if mtime > prev {
|
if mtime > prev {
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue