docs: some helpful comments
This commit is contained in:
parent
86654c8348
commit
903536bd3b
4 changed files with 25 additions and 15 deletions
14
README.md
14
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]` - close active task and move up, with optional status description
|
||||||
- `!TEXT` - set status for current task from text and move up (empty: Open)
|
- `!TEXT` - set status for current task from text and move up (empty: Open)
|
||||||
- `,[TEXT]` - list notes or add text note (comment / description)
|
- `,[TEXT]` - list notes or add text note (comment / description)
|
||||||
- TBI: `*[INT]` - set priority - can also be used in task creation, with any digit
|
- `*[INT]` - set priority - can also be used in task creation, with any digit
|
||||||
- TBI: status history and creation with attribution
|
- TBI: show status history and creation with attribution
|
||||||
- `&` - undo last action (moving in place or upwards confirms pending actions)
|
- `&` - 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)
|
- `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
|
- `-TAG` - remove tag filters by prefix
|
||||||
- `?STATUS` - filter by status (type or description) - plain `?` to reset, `??` to show all
|
- `?STATUS` - filter by status (type or description) - plain `?` to reset, `??` to show all
|
||||||
- `@AUTHOR` - filter by author (`@` for self, id prefix, name prefix)
|
- `@AUTHOR` - filter by author (`@` for self, id prefix, name prefix)
|
||||||
|
- TBI: `**INT` - filter by priority
|
||||||
- TBI: Filter by time
|
- TBI: Filter by time
|
||||||
|
|
||||||
Status descriptions can be used for example for Kanban columns or review flows.
|
Status descriptions can be used for example for Kanban columns or review flows.
|
||||||
|
@ -160,12 +161,13 @@ For debugging: `props`, `alltags`, `descriptions`
|
||||||
## Nostr reference
|
## Nostr reference
|
||||||
|
|
||||||
Mostr mainly uses the following NIPs:
|
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
|
- Issue Tracking: https://github.com/nostr-protocol/nips/blob/master/34.md
|
||||||
+ Tasks have Kind 1621 (originally: git issue - currently no native markdown support)
|
+ Tasks have Kind 1621 (originally: git issue - currently no markdown support implemented)
|
||||||
+ Kind 1622 may be used for task comments or replace Kind 1 for descriptions
|
+ TBI: Kind 1622 for task comments
|
||||||
+ Kind 1630-1633: Task Status (1630 Open, 1631 Done, 1632 Closed, 1633 Pending)
|
+ 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
|
Considering to use Calendar: https://github.com/nostr-protocol/nips/blob/master/52.md
|
||||||
- Kind 31922 for GANTT, since it has only Date
|
- Kind 31922 for GANTT, since it has only Date
|
||||||
|
|
|
@ -32,7 +32,8 @@ pub fn prompt(prompt: &str) -> Option<String> {
|
||||||
|
|
||||||
// For use in format strings but not possible, so need global find-replace
|
// For use in format strings but not possible, so need global find-replace
|
||||||
pub const MAX_TIMESTAMP_WIDTH: u8 = 15;
|
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 {
|
pub fn relative_datetimestamp(stamp: &Timestamp) -> String {
|
||||||
match Local.timestamp_opt(stamp.as_u64() as i64, 0) {
|
match Local.timestamp_opt(stamp.as_u64() as i64, 0) {
|
||||||
Single(time) => {
|
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 {
|
pub fn local_datetimestamp(stamp: &Timestamp) -> String {
|
||||||
format_stamp(stamp, "%y-%m-%d %a %H:%M")
|
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 {
|
pub fn format_stamp(stamp: &Timestamp, format: &str) -> String {
|
||||||
match Local.timestamp_opt(stamp.as_u64() as i64, 0) {
|
match Local.timestamp_opt(stamp.as_u64() as i64, 0) {
|
||||||
Single(time) => time.format(format).to_string(),
|
Single(time) => time.format(format).to_string(),
|
||||||
|
|
|
@ -205,11 +205,16 @@ impl Display for TaskState {
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Ord, PartialOrd, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Ord, PartialOrd, Eq)]
|
||||||
pub(crate) enum State {
|
pub(crate) enum State {
|
||||||
Open,
|
/// Actionable
|
||||||
|
Open = 1630,
|
||||||
|
/// Completed
|
||||||
Done,
|
Done,
|
||||||
|
/// Not Actionable (anymore)
|
||||||
Closed,
|
Closed,
|
||||||
|
/// Temporarily not actionable
|
||||||
Pending,
|
Pending,
|
||||||
Procedure,
|
/// Actionable ordered task list
|
||||||
|
Procedure = PROCEDURE_KIND as isize,
|
||||||
}
|
}
|
||||||
impl From<&str> for State {
|
impl From<&str> for State {
|
||||||
fn from(value: &str) -> Self {
|
fn from(value: &str) -> Self {
|
||||||
|
|
11
src/tasks.rs
11
src/tasks.rs
|
@ -34,21 +34,22 @@ pub(crate) struct Tasks {
|
||||||
properties: Vec<String>,
|
properties: Vec<String>,
|
||||||
/// The task properties sorted by
|
/// The task properties sorted by
|
||||||
sorting: VecDeque<String>,
|
sorting: VecDeque<String>,
|
||||||
|
|
||||||
|
/// Currently active task
|
||||||
|
position: Option<EventId>,
|
||||||
|
/// A filtered view of the current tasks
|
||||||
|
view: Vec<EventId>,
|
||||||
/// Negative: Only Leaf nodes
|
/// Negative: Only Leaf nodes
|
||||||
/// Zero: Only Active node
|
/// Zero: Only Active node
|
||||||
/// Positive: Go down the respective level
|
/// Positive: Go down the respective level
|
||||||
depth: i8,
|
depth: i8,
|
||||||
|
|
||||||
/// Currently active task
|
|
||||||
position: Option<EventId>,
|
|
||||||
/// Currently active tags
|
/// Currently active tags
|
||||||
tags: BTreeSet<Tag>,
|
tags: BTreeSet<Tag>,
|
||||||
/// Tags filtered out
|
/// Tags filtered out
|
||||||
tags_excluded: BTreeSet<Tag>,
|
tags_excluded: BTreeSet<Tag>,
|
||||||
/// Current active state
|
/// Current active state
|
||||||
state: StateFilter,
|
state: StateFilter,
|
||||||
/// A filtered view of the current tasks
|
|
||||||
view: Vec<EventId>,
|
|
||||||
|
|
||||||
sender: EventSender,
|
sender: EventSender,
|
||||||
}
|
}
|
||||||
|
@ -545,7 +546,7 @@ impl Tasks {
|
||||||
self.sender.flush();
|
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<EventId> {
|
pub(crate) fn get_filtered(&self, arg: &str) -> Vec<EventId> {
|
||||||
if let Ok(id) = EventId::parse(arg) {
|
if let Ok(id) = EventId::parse(arg) {
|
||||||
return vec![id];
|
return vec![id];
|
||||||
|
|
Loading…
Add table
Reference in a new issue