From 50ac994d21edbf33f93bb1b50e3264cfe68895f1 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Wed, 7 Aug 2024 15:04:18 +0300 Subject: [PATCH] docs: slight additions to readme and code comments --- .gitignore | 4 ++-- README.md | 4 ++-- src/task.rs | 3 +-- src/tasks.rs | 16 +++++++++++++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 0e47480..554ba2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ /target +/examples relays keys -*.html -*.rs \ No newline at end of file +*.html \ No newline at end of file diff --git a/README.md b/README.md index 7a657a7..6b7bdcb 100644 --- a/README.md +++ b/README.md @@ -139,11 +139,11 @@ For debugging: `props`, `alltags`, `descriptions` ## Nostr reference Mostr mainly uses the following NIPs: -- NIP01 for task descriptions +- Kind 1 for task descriptions - 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 - + Kind 1630-1633: Task Status (Open, Done, Closed, Pending) + + Kind 1630-1633: Task Status (1630 Open, 1631 Done, 1632 Closed, 1633 Pending) - Implementing proprietary Kind 1650 for time-tracking Considering to use Calendar: https://github.com/nostr-protocol/nips/blob/master/52.md diff --git a/src/task.rs b/src/task.rs index 4f294d1..44287ea 100644 --- a/src/task.rs +++ b/src/task.rs @@ -1,12 +1,11 @@ use fmt::Display; use std::collections::{BTreeSet, HashSet}; use std::fmt; -use std::ops::Div; use itertools::Either::{Left, Right}; use itertools::Itertools; use log::{debug, error, info, trace, warn}; -use nostr_sdk::{Alphabet, Event, EventBuilder, EventId, Kind, Tag, TagStandard, Timestamp}; +use nostr_sdk::{Event, EventBuilder, EventId, Kind, Tag, TagStandard, Timestamp}; use crate::helpers::some_non_empty; use crate::kinds::is_hashtag; diff --git a/src/tasks.rs b/src/tasks.rs index 8a41bda..070b946 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -64,7 +64,7 @@ impl Tasks { "rpath".into(), "desc".into(), ], - position: None, + position: None, // TODO persist position view: Default::default(), tags: Default::default(), state: None, @@ -300,6 +300,7 @@ impl Tasks { writeln!( lock, "{} since {} (total tracked time {}m)", + // TODO tracking since, scheduled/planned for state.get_label(), match Local.timestamp_opt(state.time.as_u64() as i64, 0) { Single(time) => { @@ -322,7 +323,7 @@ impl Tasks { )?; writeln!(lock, "{}", t.descriptions().join("\n"))?; } - // TODO proper columns + // TODO proper column alignment writeln!(lock, "{}", self.properties.join("\t").bold())?; for task in self.current_tasks() { writeln!( @@ -728,6 +729,8 @@ mod tasks_test { tasks.track_at(Timestamp::from(2)); assert_eq!(tasks.get_own_history().unwrap().len(), 3); assert_eq!(tasks.time_tracked(zero), 1); + + // TODO test received events } #[test] @@ -819,8 +822,15 @@ mod tasks_test { ); assert_eq!(tasks.relative_path(dangling), "test"); + } + + #[allow(dead_code)] + fn test_itertools() { use itertools::Itertools; - assert_eq!("test toast".split(' ').collect_vec().len(), 3); + assert_eq!( + "test toast".split(' ').collect_vec().len(), + 3 + ); assert_eq!( "test toast".split_ascii_whitespace().collect_vec().len(), 2