diff --git a/README.md b/README.md index 0df816f..a8e0709 100644 --- a/README.md +++ b/README.md @@ -114,8 +114,8 @@ Dot or slash can be repeated to move to parent tasks before acting. - `<[TEXT]` - close active task and move up, with optional status description - `!TEXT` - set status for current task from text and move up (empty: Open) - `,[TEXT]` - list notes or add text note (comment / description) -- TBI: `*[INT]` - set priority - can also be used in task creation, with any digit -- TBI: status history and creation with attribution +- `*[INT]` - set priority - can also be used in task creation, with any digit +- TBI: show status history and creation with attribution - `&` - undo last action (moving in place or upwards confirms pending actions) - `wss://...` - switch or subscribe to relay (prefix with space to forcibly add a new one) @@ -126,6 +126,7 @@ Property Filters: - `-TAG` - remove tag filters by prefix - `?STATUS` - filter by status (type or description) - plain `?` to reset, `??` to show all - `@AUTHOR` - filter by author (`@` for self, id prefix, name prefix) +- TBI: `**INT` - filter by priority - TBI: Filter by time Status descriptions can be used for example for Kanban columns or review flows. @@ -160,12 +161,13 @@ For debugging: `props`, `alltags`, `descriptions` ## Nostr reference Mostr mainly uses the following NIPs: -- Kind 1 for task descriptions + +- Kind 1 for task descriptions and permanent tasks, can contain task property updates (tags, priority) - Issue Tracking: https://github.com/nostr-protocol/nips/blob/master/34.md - + Tasks have Kind 1621 (originally: git issue - currently no native markdown support) - + Kind 1622 may be used for task comments or replace Kind 1 for descriptions + + Tasks have Kind 1621 (originally: git issue - currently no markdown support implemented) + + TBI: Kind 1622 for task comments + Kind 1630-1633: Task Status (1630 Open, 1631 Done, 1632 Closed, 1633 Pending) -- Implementing proprietary Kind 1650 for time-tracking +- Own Kind 1650 for time-tracking Considering to use Calendar: https://github.com/nostr-protocol/nips/blob/master/52.md - Kind 31922 for GANTT, since it has only Date diff --git a/src/helpers.rs b/src/helpers.rs index 3a0d7b9..658e659 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -32,7 +32,8 @@ pub fn prompt(prompt: &str) -> Option { // For use in format strings but not possible, so need global find-replace pub const MAX_TIMESTAMP_WIDTH: u8 = 15; -/// Format nostr Timestamp relative to local time with optional day specifier or full date if needed +/// Format nostr Timestamp relative to local time +/// with optional day specifier or full date depending on distance to today pub fn relative_datetimestamp(stamp: &Timestamp) -> String { match Local.timestamp_opt(stamp.as_u64() as i64, 0) { Single(time) => { @@ -54,11 +55,12 @@ pub fn relative_datetimestamp(stamp: &Timestamp) -> String { } } +/// Format a nostr timestamp in a sensible comprehensive format pub fn local_datetimestamp(stamp: &Timestamp) -> String { format_stamp(stamp, "%y-%m-%d %a %H:%M") } - +/// Format a nostr timestamp with the given format pub fn format_stamp(stamp: &Timestamp, format: &str) -> String { match Local.timestamp_opt(stamp.as_u64() as i64, 0) { Single(time) => time.format(format).to_string(), diff --git a/src/task.rs b/src/task.rs index d9280d5..2091dbc 100644 --- a/src/task.rs +++ b/src/task.rs @@ -205,11 +205,16 @@ impl Display for TaskState { #[derive(Debug, Copy, Clone, PartialEq, Ord, PartialOrd, Eq)] pub(crate) enum State { - Open, + /// Actionable + Open = 1630, + /// Completed Done, + /// Not Actionable (anymore) Closed, + /// Temporarily not actionable Pending, - Procedure, + /// Actionable ordered task list + Procedure = PROCEDURE_KIND as isize, } impl From<&str> for State { fn from(value: &str) -> Self { diff --git a/src/tasks.rs b/src/tasks.rs index deb83d5..d7af23c 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -34,21 +34,22 @@ pub(crate) struct Tasks { properties: Vec, /// The task properties sorted by sorting: VecDeque, + + /// Currently active task + position: Option, + /// A filtered view of the current tasks + view: Vec, /// Negative: Only Leaf nodes /// Zero: Only Active node /// Positive: Go down the respective level depth: i8, - /// Currently active task - position: Option, /// Currently active tags tags: BTreeSet, /// Tags filtered out tags_excluded: BTreeSet, /// Current active state state: StateFilter, - /// A filtered view of the current tasks - view: Vec, sender: EventSender, } @@ -545,7 +546,7 @@ impl Tasks { self.sender.flush(); } - /// Returns ids of tasks matching the filter. + /// Returns ids of tasks starting with the given string. pub(crate) fn get_filtered(&self, arg: &str) -> Vec { if let Ok(id) = EventId::parse(arg) { return vec![id];