forked from janek/mostr
1
0
Fork 0

docs: slight additions to readme and code comments

This commit is contained in:
xeruf 2024-08-07 15:04:18 +03:00
parent 65207a1de2
commit 50ac994d21
4 changed files with 18 additions and 9 deletions

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
/target /target
/examples
relays relays
keys keys
*.html *.html
*.rs

View File

@ -139,11 +139,11 @@ For debugging: `props`, `alltags`, `descriptions`
## Nostr reference ## Nostr reference
Mostr mainly uses the following NIPs: 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 - 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 native markdown support)
+ Kind 1622 may be used for task comments or replace Kind 1 for descriptions + 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 - Implementing proprietary 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

View File

@ -1,12 +1,11 @@
use fmt::Display; use fmt::Display;
use std::collections::{BTreeSet, HashSet}; use std::collections::{BTreeSet, HashSet};
use std::fmt; use std::fmt;
use std::ops::Div;
use itertools::Either::{Left, Right}; use itertools::Either::{Left, Right};
use itertools::Itertools; use itertools::Itertools;
use log::{debug, error, info, trace, warn}; 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::helpers::some_non_empty;
use crate::kinds::is_hashtag; use crate::kinds::is_hashtag;

View File

@ -64,7 +64,7 @@ impl Tasks {
"rpath".into(), "rpath".into(),
"desc".into(), "desc".into(),
], ],
position: None, position: None, // TODO persist position
view: Default::default(), view: Default::default(),
tags: Default::default(), tags: Default::default(),
state: None, state: None,
@ -300,6 +300,7 @@ impl Tasks {
writeln!( writeln!(
lock, lock,
"{} since {} (total tracked time {}m)", "{} since {} (total tracked time {}m)",
// TODO tracking since, scheduled/planned for
state.get_label(), state.get_label(),
match Local.timestamp_opt(state.time.as_u64() as i64, 0) { match Local.timestamp_opt(state.time.as_u64() as i64, 0) {
Single(time) => { Single(time) => {
@ -322,7 +323,7 @@ impl Tasks {
)?; )?;
writeln!(lock, "{}", t.descriptions().join("\n"))?; writeln!(lock, "{}", t.descriptions().join("\n"))?;
} }
// TODO proper columns // TODO proper column alignment
writeln!(lock, "{}", self.properties.join("\t").bold())?; writeln!(lock, "{}", self.properties.join("\t").bold())?;
for task in self.current_tasks() { for task in self.current_tasks() {
writeln!( writeln!(
@ -728,6 +729,8 @@ mod tasks_test {
tasks.track_at(Timestamp::from(2)); tasks.track_at(Timestamp::from(2));
assert_eq!(tasks.get_own_history().unwrap().len(), 3); assert_eq!(tasks.get_own_history().unwrap().len(), 3);
assert_eq!(tasks.time_tracked(zero), 1); assert_eq!(tasks.time_tracked(zero), 1);
// TODO test received events
} }
#[test] #[test]
@ -819,8 +822,15 @@ mod tasks_test {
); );
assert_eq!(tasks.relative_path(dangling), "test"); assert_eq!(tasks.relative_path(dangling), "test");
}
#[allow(dead_code)]
fn test_itertools() {
use itertools::Itertools; use itertools::Itertools;
assert_eq!("test toast".split(' ').collect_vec().len(), 3); assert_eq!(
"test toast".split(' ').collect_vec().len(),
3
);
assert_eq!( assert_eq!(
"test toast".split_ascii_whitespace().collect_vec().len(), "test toast".split_ascii_whitespace().collect_vec().len(),
2 2