Compare commits

..

No commits in common. "84e46827cedf5e271236a59cbeb035be29e30d7a" and "c3d18e449461f3eea8bb46e286a6e200511d6aa4" have entirely different histories.

3 changed files with 10 additions and 17 deletions

View File

@ -5,8 +5,6 @@ use chrono::LocalResult::Single;
use log::{debug, error, info, trace, warn};
use nostr_sdk::Timestamp;
pub const CHARACTER_THRESHOLD: usize = 3;
pub fn some_non_empty(str: &str) -> Option<String> {
if str.is_empty() { None } else { Some(str.to_string()) }
}
@ -35,7 +33,7 @@ pub fn parse_date(str: &str) -> Option<DateTime<Utc>> {
match parse_datetime::parse_datetime_at_date(Local::now(), str) {
Ok(date) => Some(date.to_utc()),
Err(_) => {
warn!("Could not parse date from \"{str}\": {e}");
warn!("Could not parse date from {str}: {e}");
None
}
}

View File

@ -415,13 +415,7 @@ async fn main() -> Result<()> {
);
continue;
}
Some(arg) => {
if arg.len() < CHARACTER_THRESHOLD {
warn!("Note needs at least {CHARACTER_THRESHOLD} characters!");
continue
}
tasks.make_note(arg)
},
Some(arg) => tasks.make_note(arg),
}
Some('>') => {

View File

@ -14,7 +14,7 @@ use nostr_sdk::prelude::Marker;
use TagStandard::Hashtag;
use crate::{EventSender, MostrMessage};
use crate::helpers::{CHARACTER_THRESHOLD, format_timestamp_local, format_timestamp_relative, format_timestamp_relative_to, parse_tracking_stamp, some_non_empty};
use crate::helpers::{format_timestamp_local, format_timestamp_relative, format_timestamp_relative_to, parse_tracking_stamp, some_non_empty};
use crate::kinds::*;
use crate::task::{MARKER_DEPENDS, MARKER_PARENT, State, Task, TaskState};
@ -128,8 +128,8 @@ impl Tasks {
"desc",
].into_iter().map(|s| s.to_string()).collect(),
sorting: [
"state",
"author",
"state",
"hashtags",
"rtime",
"name",
@ -490,7 +490,7 @@ impl Tasks {
}
"progress" => prog_string.clone(),
"author" => format!("{:.6}", self.get_author(&task.event.pubkey)), // FIXME temporary until proper column alignment
"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
@ -594,11 +594,12 @@ impl Tasks {
0 => {
// No match, new task
self.view.clear();
if arg.len() < CHARACTER_THRESHOLD {
warn!("New task name needs at least {CHARACTER_THRESHOLD} characters");
return None
if arg.len() > 2 {
Some(self.make_task_with(arg, self.position_tags_for(position), true))
} else {
warn!("Name of a task needs to have at least 3 characters");
None
}
Some(self.make_task_with(arg, self.position_tags_for(position), true))
}
1 => {
// One match, activate