forked from janek/mostr
1
0
Fork 0

style: reformat code

This commit is contained in:
xeruf 2024-08-08 13:52:02 +03:00
parent a3a732879f
commit 79b42b8df0
4 changed files with 21 additions and 19 deletions

View File

@ -41,17 +41,17 @@ pub(crate) fn build_task(name: &str, tags: Vec<Tag>) -> EventBuilder {
fn format_tag(tag: &Tag) -> String { fn format_tag(tag: &Tag) -> String {
match tag.as_standardized() { match tag.as_standardized() {
Some(TagStandard::Event { Some(TagStandard::Event {
event_id, event_id,
.. ..
}) => format!("Parent: {}", event_id.to_string()[..8].to_string()), }) => format!("Parent: {}", event_id.to_string()[..8].to_string()),
Some(TagStandard::PublicKey { Some(TagStandard::PublicKey {
public_key, public_key,
.. ..
}) => format!("Key: {}", public_key.to_string()[..8].to_string()), }) => format!("Key: {}", public_key.to_string()[..8].to_string()),
Some(TagStandard::Hashtag(content)) => format!("#{content}"), Some(TagStandard::Hashtag(content)) => format!("#{content}"),
_ => tag.content().map_or_else( _ => tag.content().map_or_else(
|| format!("Kind {}", tag.kind()), || format!("Kind {}", tag.kind()),
|content| content.to_string() |content| content.to_string(),
) )
} }
} }

View File

@ -8,8 +8,9 @@ use std::ops::Sub;
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
use std::sync::mpsc; use std::sync::mpsc;
use std::sync::mpsc::{Sender}; use std::sync::mpsc::Sender;
use chrono::{DateTime};
use chrono::DateTime;
use colored::Colorize; use colored::Colorize;
use itertools::Itertools; use itertools::Itertools;
use log::{debug, error, info, trace, warn}; use log::{debug, error, info, trace, warn};
@ -290,7 +291,7 @@ async fn main() {
tasks.add_or_remove_property_column(arg); tasks.add_or_remove_property_column(arg);
} else { } else {
println!("{}", PROPERTY_COLUMNS); println!("{}", PROPERTY_COLUMNS);
continue continue;
}, },
Some(',') => { Some(',') => {
@ -300,8 +301,8 @@ async fn main() {
|| info!("With a task selected, use ,NOTE to attach NOTE and , to list all its notes"), || info!("With a task selected, use ,NOTE to attach NOTE and , to list all its notes"),
|task| println!("{}", task.description_events().map(|e| format!("{} {}", e.created_at.to_human_datetime(), e.content)).join("\n")), |task| println!("{}", task.description_events().map(|e| format!("{} {}", e.created_at.to_human_datetime(), e.content)).join("\n")),
); );
continue continue;
}, }
Some(arg) => tasks.make_note(arg), Some(arg) => tasks.make_note(arg),
} }
} }
@ -336,7 +337,7 @@ async fn main() {
Some(arg) => tasks.set_tag(arg.to_string()), Some(arg) => tasks.set_tag(arg.to_string()),
None => { None => {
println!("Hashtags of all known tasks:\n{}", tasks.all_hashtags().join(" ")); println!("Hashtags of all known tasks:\n{}", tasks.all_hashtags().join(" "));
continue continue;
} }
} }
} }
@ -440,7 +441,7 @@ async fn main() {
selected_relay = new_relay; selected_relay = new_relay;
} }
//or_print(tasks.print_tasks()); //or_print(tasks.print_tasks());
continue continue;
} else { } else {
tasks.filter_or_create(&input); tasks.filter_or_create(&input);
} }

View File

@ -1,9 +1,10 @@
use std::collections::{BTreeSet, HashMap}; use std::collections::{BTreeSet, HashMap};
use std::io::{Error, stdout, Write}; use std::io::{Error, stdout, Write};
use std::iter::{once, Sum}; use std::iter::once;
use std::ops::{Div, Rem}; use std::ops::{Div, Rem};
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::time::Duration; use std::time::Duration;
use chrono::{DateTime, Local, TimeZone}; use chrono::{DateTime, Local, TimeZone};
use chrono::LocalResult::Single; use chrono::LocalResult::Single;
use colored::Colorize; use colored::Colorize;