From 2255abc1b80ecc11e906b5fb08a96f764d6e3efc Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sun, 18 Aug 2024 21:54:05 +0300 Subject: [PATCH] docs: unify property columns documentation --- README.md | 28 +++++----------------------- src/kinds.rs | 29 ++++++++++++++++++++--------- src/task.rs | 8 +++++--- src/tasks.rs | 5 +++-- 4 files changed, 33 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index a8e0709..f0280c4 100644 --- a/README.md +++ b/README.md @@ -105,8 +105,9 @@ To stop time-tracking completely, simply move to the root of all tasks. Dot or slash can be repeated to move to parent tasks before acting. -- `:[IND][PROP]` - add property column PROP at IND or end, if it already exists remove property column PROP or IND (1-indexed) -- `::[PROP]` - Sort by property PROP (multiple space-separated values allowed) +- `:[IND][PROP]` - add property column PROP at IND or end, if it already exists remove property column PROP or IND ( + 1-indexed), empty: list properties +- `::[PROP]` - sort by property PROP (multiple space-separated values allowed) - `([TIME]` - list tracked times or insert timetracking with the specified offset such as `-1d`, `-15 minutes`, `yesterday 17:20`, `in 2 fortnights` - `)[TIME]` - stop timetracking with optional offset - also convenience helper to move to root @@ -132,27 +133,6 @@ Property Filters: Status descriptions can be used for example for Kanban columns or review flows. An active tag or status filter will also set that attribute for newly created tasks. -### Available Columns - -- `id` -- `parentid` -- `name` -- `state` - indicator of current progress -- `status` - pure task status -- `hashtags` - list of hashtags set for the task -- `tags` - values of all nostr tags associated with the event, except event tags -- `desc` - last note on the task -- `description` - accumulated notes on the task -- `path` - name including parent tasks -- `rpath` - name including parent tasks up to active task -- `time` - time tracked on this task -- `rtime` - time tracked on this tasks and all recursive subtasks -- `progress` - recursive subtask completion in percent -- `subtasks` - how many direct subtasks are complete -- TBI `depends` - -For debugging: `props`, `alltags`, `descriptions` - ### Notes - TBI = To Be Implemented @@ -209,6 +189,8 @@ The following features are not ready to be implemented because they need conceptualization. Suggestions welcome! +- Do not track time on Closed task? +- Allow adding new parent via description? - Special commands: help, exit, tutorial, change log level - Duplicate task (subtasks? timetracking?) - What if I want to postpone a procedure, i.e. make it pending, or move it across kanban, does this make sense? diff --git a/src/kinds.rs b/src/kinds.rs index 2e88359..77e8e2b 100644 --- a/src/kinds.rs +++ b/src/kinds.rs @@ -15,21 +15,32 @@ pub const KINDS: [u16; 9] = [ PROCEDURE_KIND, 1630, 1631, 1632, 1633]; -pub const PROPERTY_COLUMNS: &str = "Available properties: -- `id` -- `parentid` -- `name` -- `state` -- `hashtags` +/// Helper for available properties. +/// TODO: use formatting - bold / heading / italics - and generate from code +pub const PROPERTY_COLUMNS: &str = + "# Available Properties +Immutable: +- `id` - unique task id +- `parentid` - unique task id of the parent, if any +- `name` - initial name of the task +- `created` - task creation timestamp +- `author` - name of the task creator +Task: +- `status` - pure task status +- `hashtags` - list of hashtags set for the task - `tags` - values of all nostr tags associated with the event, except event tags - `desc` - last note on the task - `description` - accumulated notes on the task -- `path` - name including parent tasks -- `rpath` - name including parent tasks up to active task - `time` - time tracked on this task by you +Utilities: +- `state` - indicator of current progress - `rtime` - time tracked on this tasks and its subtree by everyone - `progress` - recursive subtask completion in percent -- `subtasks` - how many direct subtasks are complete"; +- `subtasks` - how many direct subtasks are complete +- `path` - name including parent tasks +- `rpath` - name including parent tasks up to active task +- TBI `depends` - list all tasks this task depends on before it becomes actionable +Debugging: `pubkey`, `props`, `alltags`, `descriptions`"; pub(crate) fn build_tracking(id: I) -> EventBuilder where diff --git a/src/task.rs b/src/task.rs index a853c29..80f40ed 100644 --- a/src/task.rs +++ b/src/task.rs @@ -139,10 +139,14 @@ impl Task { pub(crate) fn get(&self, property: &str) -> Option { match property { + // Static "id" => Some(self.event.id.to_string()), "parentid" => self.parent_id().map(|i| i.to_string()), - "status" => Some(self.state_or_default().get_label()), "name" => Some(self.event.content.clone()), + "pubkey" => Some(self.event.pubkey.to_string()), + "created" => Some(local_datetimestamp(&self.event.created_at)), + // Dynamic + "status" => Some(self.state_or_default().get_label()), "desc" => self.descriptions().last().cloned(), "description" => Some(self.descriptions().join(" ")), "hashtags" => self.filter_tags(|tag| { is_hashtag(tag) }), @@ -160,8 +164,6 @@ impl Task { "{:?}", self.descriptions().collect_vec() )), - "pubkey" => Some(self.event.pubkey.to_string()), - "created" => Some(local_datetimestamp(&self.event.created_at)), _ => { warn!("Unknown task property {}", property); None diff --git a/src/tasks.rs b/src/tasks.rs index d7af23c..59c5433 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -473,8 +473,9 @@ impl Tasks { state.get_colored_label() }.to_string() } - "author" => self.get_author(&task.event.pubkey), "progress" => prog_string.clone(), + + "author" => self.get_author(&task.event.pubkey), "path" => self.get_task_path(Some(task.event.id)), "rpath" => self.relative_path(task.event.id), // TODO format strings configurable @@ -719,7 +720,7 @@ impl Tasks { let stripped = str.trim().trim_start_matches('+').trim_start_matches("in "); if let Ok(num) = stripped.parse::() { self.track_at(Timestamp::from(Timestamp::now().as_u64().saturating_add_signed(num * 60))); - return true + return true; } match interim::parse_date_string(stripped, Local::now(), interim::Dialect::Us) { Ok(date) => Some(date.to_utc()),