commit 7dbd81f3987b12554d03c1e6172846e4060abd95
Author: randymcmillan <
[email protected]>
Date: Sun May 5 14:39:53 2024 -0400
src/bin:apply cargo fmt
cargo +nightly fmt
diff --git a/bins/src/bin/gnostr-add.rs b/bins/src/bin/gnostr-add.rs
index 25e972c7a..9c90700ca 100644
--- a/bins/src/bin/gnostr-add.rs
+++ b/bins/src/bin/gnostr-add.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
@@ -15,8 +16,9 @@
#![deny(warnings)]
#![allow(trivial_casts)]
-use git2::Repository;
use std::path::Path;
+
+use git2::Repository;
use structopt::StructOpt;
#[derive(StructOpt)]
diff --git a/bins/src/bin/gnostr-bech32-to-any.rs b/bins/src/bin/gnostr-bech32-to-any.rs
index d1fe564ac..f99973982 100644
--- a/bins/src/bin/gnostr-bech32-to-any.rs
+++ b/bins/src/bin/gnostr-bech32-to-any.rs
@@ -1,6 +1,7 @@
+use std::env;
+
use bech32::FromBase32;
use gnostr_types::{NostrBech32, PrivateKey};
-use std::env;
fn main() {
let mut args = env::args();
diff --git a/bins/src/bin/gnostr-blame.rs b/bins/src/bin/gnostr-blame.rs
index 7cb1b6947..83e5f9c4c 100644
--- a/bins/src/bin/gnostr-blame.rs
+++ b/bins/src/bin/gnostr-blame.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
@@ -14,9 +15,10 @@
#![deny(warnings)]
-use git2::{BlameOptions, Repository};
use std::io::{BufRead, BufReader};
use std::path::Path;
+
+use git2::{BlameOptions, Repository};
use structopt::StructOpt;
#[derive(StructOpt)]
diff --git a/bins/src/bin/gnostr-cat-file.rs b/bins/src/bin/gnostr-cat-file.rs
index 0ce21b34a..0f5960055 100644
--- a/bins/src/bin/gnostr-cat-file.rs
+++ b/bins/src/bin/gnostr-cat-file.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
diff --git a/bins/src/bin/gnostr-cli-example.rs b/bins/src/bin/gnostr-cli-example.rs
index 8d3671532..9dd6dd863 100644
--- a/bins/src/bin/gnostr-cli-example.rs
+++ b/bins/src/bin/gnostr-cli-example.rs
@@ -1,5 +1,6 @@
-use reqwest::Url;
use std::io::Read;
+
+use reqwest::Url;
fn main() {
let url = Url::parse("https://raw.githubusercontent.com/gnostr-org/gnostr-bins/master/src/bin/gnostr-cli-example.rs").unwrap();
let mut res = reqwest::blocking::get(url).unwrap();
diff --git a/bins/src/bin/gnostr-clone.rs b/bins/src/bin/gnostr-clone.rs
index 5af73222f..aebfad424 100644
--- a/bins/src/bin/gnostr-clone.rs
+++ b/bins/src/bin/gnostr-clone.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
@@ -14,11 +15,12 @@
#![deny(warnings)]
-use git2::build::{CheckoutBuilder, RepoBuilder};
-use git2::{FetchOptions, Progress, RemoteCallbacks};
use std::cell::RefCell;
use std::io::{self, Write};
use std::path::{Path, PathBuf};
+
+use git2::build::{CheckoutBuilder, RepoBuilder};
+use git2::{FetchOptions, Progress, RemoteCallbacks};
use structopt::StructOpt;
#[derive(StructOpt)]
@@ -59,8 +61,8 @@ fn print(state: &mut State) {
);
} else {
print!(
- "net {:3}% ({:4} kb, {:5}/{:5}) / idx {:3}% ({:5}/{:5}) \
- / chk {:3}% ({:4}/{:4}) {}\r",
+ "net {:3}% ({:4} kb, {:5}/{:5}) / idx {:3}% ({:5}/{:5}) / chk {:3}% ({:4}/{:4}) \
+ {}\r",
network_pct,
kbytes,
stats.received_objects(),
diff --git a/bins/src/bin/gnostr-dashboard.rs b/bins/src/bin/gnostr-dashboard.rs
index b169a925d..77f0a78f8 100755
--- a/bins/src/bin/gnostr-dashboard.rs
+++ b/bins/src/bin/gnostr-dashboard.rs
@@ -1,30 +1,24 @@
-use chrono::prelude::*;
-use crossterm::{
- event::{self, Event as CEvent, KeyCode},
- terminal::{disable_raw_mode, enable_raw_mode},
-};
-use rand::{distributions::Alphanumeric, prelude::*};
-use serde::{Deserialize, Serialize};
-use std::fs;
-use std::io;
-use std::process;
use std::sync::mpsc;
-use std::thread;
use std::time::{Duration, Instant};
-use thiserror::Error;
-use tui::{
- backend::CrosstermBackend,
- layout::{Alignment, Constraint, Direction, Layout},
- style::{Color, Modifier, Style},
- text::{Span, Spans},
- widgets::{
- Block, BorderType, Borders, Cell, List, ListItem, ListState, Paragraph, Row, Table, Tabs,
- },
- Terminal,
-};
+use std::{fs, io, process, thread};
+use chrono::prelude::*;
+use crossterm::event::{self, Event as CEvent, KeyCode};
+use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
use homedir::get_my_home;
-const APP_NAME:&str = env!("CARGO_PKG_NAME");
+use rand::distributions::Alphanumeric;
+use rand::prelude::*;
+use serde::{Deserialize, Serialize};
+use thiserror::Error;
+use tui::backend::CrosstermBackend;
+use tui::layout::{Alignment, Constraint, Direction, Layout};
+use tui::style::{Color, Modifier, Style};
+use tui::text::{Span, Spans};
+use tui::widgets::{
+ Block, BorderType, Borders, Cell, List, ListItem, ListState, Paragraph, Row, Table, Tabs,
+};
+use tui::Terminal;
+const APP_NAME: &str = env!("CARGO_PKG_NAME");
const VERSION: &str = env!("CARGO_PKG_VERSION");
const ICON_FONT_SIZE: u16 = 12;
@@ -105,7 +99,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut terminal = Terminal::new(backend)?;
terminal.clear()?;
-
//MENU TITLES
let menu_titles = vec!["Home", "Relays", "Add", "Delete", "Quit"];
@@ -130,14 +123,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
)
.split(size);
- let copyright = Paragraph::new(format!(" {} FOOTER",APP_NAME))
+ let copyright = Paragraph::new(format!(" {} FOOTER", APP_NAME))
.style(Style::default().fg(Color::LightCyan))
.alignment(Alignment::Left)
.block(
Block::default()
.borders(Borders::ALL)
.style(Style::default().fg(Color::White))
- .title(format!(" {} v{}",APP_NAME,VERSION))
+ .title(format!(" {} v{}", APP_NAME, VERSION))
.border_type(BorderType::Plain),
);
@@ -180,7 +173,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
//footer not persist after quit here
rect.render_widget(copyright.clone(), chunks[2]);
-
}
}
})?;
@@ -234,136 +226,213 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
fn render_home<'a>() -> Paragraph<'a> {
let home = Paragraph::new(vec![
+ //REF: Unicode Character “█” (U+2588)
-//REF: Unicode Character “█” (U+2588)
-
-//center line
-//Spans::from(vec![Span::raw("
-//███████████████████████████████████████•███████████████████████████████████████
-//")]),
-Spans::from(vec![Span::raw("")]),
-Spans::from(vec![Span::raw("")]),
-Spans::from(vec![Span::raw("")]),
-Spans::from(vec![Span::raw("
- █•█ ")]),
-Spans::from(vec![Span::raw("
- ███•███ ")]),
-Spans::from(vec![Span::raw("
- █████•█████ ")]),
-Spans::from(vec![Span::raw("
- ███████•███████ ")]),
-Spans::from(vec![Span::raw("
- █████████•█████████ ")]),
-Spans::from(vec![Span::raw("
- ██████████•███████████ ")]),
-Spans::from(vec![Span::raw("
-█ ████████•█████████████")]),
-Spans::from(vec![Span::raw("
- ████ ██████•███████████████")]),
-Spans::from(vec![Span::raw("
- ████████ ███•█████████████████")]),
-Spans::from(vec![Span::raw("
- ████████████ █•███████████████████")]),
-Spans::from(vec![Span::raw("
- ████████████████ ██████████████████ ")]),
-Spans::from(vec![Span::raw("
+ //center line
+ //Spans::from(vec![Span::raw("
+ //███████████████████████████████████████•███████████████████████████████████████
+ //")]),
+ Spans::from(vec![Span::raw("")]),
+ Spans::from(vec![Span::raw("")]),
+ Spans::from(vec![Span::raw("")]),
+ Spans::from(vec![Span::raw(
+ "
+ █•█ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ███•███ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █████•█████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ███████•███████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █████████•█████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ██████████•███████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+█ ████████•█████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████ ██████•███████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████ ███•█████████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████████ █•███████████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████████████ ██████████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
██████████████████ ██████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
███████████████████ ███████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
█████████████████████ █████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
████████████████████████ ████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
████████████████████████████ ████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
███████████████████████████████ █ ████████████████████████
-")]),
-Spans::from(vec![Span::raw("
- ██████████████████████████████████ ███ ██████████████████████ ")]),
-Spans::from(vec![Span::raw("
-████████████████████████████████████ █████ ████████████████████")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ██████████████████████████████████ ███ ██████████████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+████████████████████████████████████ █████ ████████████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
█████████████████████████████████████ ███████ ██████████████████
-")]),
-//vim command to find center
-//:exe 'normal '.(virtcol('$')/2).'|'
-// █
-// ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▐ ▔ ▕ ▀ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▐ ▔ ▕
-// █
-// █
-//FULL BLOCK
-//Unicode: U+2588, UTF-8: E2 96 88
-
-//center line
-Spans::from(vec![Span::raw("
+",
+ )]),
+ //vim command to find center
+ //:exe 'normal '.(virtcol('$')/2).'|'
+ // █
+ // ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▐ ▔ ▕ ▀ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▐ ▔ ▕
+ // █
+ // █
+ //FULL BLOCK
+ //Unicode: U+2588, UTF-8: E2 96 88
+
+ //center line
+ Spans::from(vec![Span::raw(
+ "
█████████████████████████████████████ • ███████ █████████████████
-")]),
-
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
████████████████████████████████████ ████████ ████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
██████████████████████████████████ ██████████ ███████████████
-")]),
-Spans::from(vec![Span::raw("
-████████████████████████████████ ███████████████████████████████")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+████████████████████████████████ ███████████████████████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
███████████████████████████████ ██████████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
█████████████████████████████ ████████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
██████████████████████████ █████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
██████████████████████ █████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
███████████████████ ██████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
█████████████████ ████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
████████████████ ███████████████
-")]),
-Spans::from(vec![Span::raw("
-████████████████ ███████████████")]),
-Spans::from(vec![Span::raw("
- ████████████████•████████████████ ")]),
-Spans::from(vec![Span::raw("
- ██████████████•██████████████ ")]),
-Spans::from(vec![Span::raw("
- ████████████•████████████ ")]),
-Spans::from(vec![Span::raw("
- █████████•█████████ ")]),
-Spans::from(vec![Span::raw("
- ███████•███████ ")]),
-Spans::from(vec![Span::raw("
- █████•█████ ")]),
-Spans::from(vec![Span::raw("
- ███•███ ")]),
-Spans::from(vec![Span::raw("
- █•█ ")]),
-//center line
-//Spans::from(vec![Span::raw("
-//███████████████████████████████████████•███████████████████████████████████████
-//")]),
-
-
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+████████████████ ███████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████████████•████████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ██████████████•██████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████████•████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █████████•█████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ███████•███████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █████•█████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ███•███ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █•█ ",
+ )]),
+ //center line
+ //Spans::from(vec![Span::raw("
+ //███████████████████████████████████████•███████████████████████████████████████
+ //")]),
Spans::from(vec![Span::styled(
" ",
Style::default().fg(Color::LightBlue),
)]),
Spans::from(vec![Span::raw("")]),
- //Spans::from(vec![Span::raw("Press 'p' to access pets, 'a' to add random new pets and 'd' to delete the currently selected pet.")]),
+ //Spans::from(vec![Span::raw("Press 'p' to access pets, 'a' to add random new pets and 'd'
+ // to delete the currently selected pet.")]),
])
.alignment(Alignment::Center)
.block(
diff --git a/bins/src/bin/gnostr-diff.rs b/bins/src/bin/gnostr-diff.rs
index 62f165db3..c19a39547 100644
--- a/bins/src/bin/gnostr-diff.rs
+++ b/bins/src/bin/gnostr-diff.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
@@ -14,9 +15,12 @@
#![deny(warnings)]
-use git2::{Blob, Diff, DiffOptions, Error, Object, ObjectType, Oid, Repository};
-use git2::{DiffDelta, DiffFindOptions, DiffFormat, DiffHunk, DiffLine};
use std::str;
+
+use git2::{
+ Blob, Diff, DiffDelta, DiffFindOptions, DiffFormat, DiffHunk, DiffLine, DiffOptions, Error,
+ Object, ObjectType, Oid, Repository,
+};
use structopt::StructOpt;
#[derive(StructOpt)]
diff --git a/bins/src/bin/gnostr-dump-relay.rs b/bins/src/bin/gnostr-dump-relay.rs
index 721edf7be..b4ecb4f8f 100644
--- a/bins/src/bin/gnostr-dump-relay.rs
+++ b/bins/src/bin/gnostr-dump-relay.rs
@@ -1,9 +1,10 @@
// TEMPORARILY
#![allow(clippy::uninlined_format_args)]
-use gnostr_types::Filter;
use std::env;
+use gnostr_types::Filter;
+
fn main() {
let mut args = env::args();
let _ = args.next(); // program name
diff --git a/bins/src/bin/gnostr-fetch-by-id.rs b/bins/src/bin/gnostr-fetch-by-id.rs
index b59d8850d..5117e4026 100644
--- a/bins/src/bin/gnostr-fetch-by-id.rs
+++ b/bins/src/bin/gnostr-fetch-by-id.rs
@@ -1,8 +1,10 @@
-use gnostr_types::IdHex;
use std::env;
+use gnostr_types::IdHex;
+
fn main() {
- //gnostr-fetch-by-id wss://relay.damus.io fc7aeb54b43215bff5b561bf59fb72128e36d67ef1092ba9c8ca7cdcfc68a439
+ //gnostr-fetch-by-id wss://relay.damus.io
+ // fc7aeb54b43215bff5b561bf59fb72128e36d67ef1092ba9c8ca7cdcfc68a439
let mut args = env::args();
let _ = args.next(); // program name
diff --git a/bins/src/bin/gnostr-fetch-by-kind-and-author.rs b/bins/src/bin/gnostr-fetch-by-kind-and-author.rs
index 0fc668287..2316a3e64 100644
--- a/bins/src/bin/gnostr-fetch-by-kind-and-author.rs
+++ b/bins/src/bin/gnostr-fetch-by-kind-and-author.rs
@@ -1,6 +1,7 @@
-use gnostr_types::{EventKind, Filter, PublicKey, PublicKeyHex};
use std::env;
+use gnostr_types::{EventKind, Filter, PublicKey, PublicKeyHex};
+
fn main() {
let mut args = env::args();
let _ = args.next(); // program name
diff --git a/bins/src/bin/gnostr-fetch-metadata.rs b/bins/src/bin/gnostr-fetch-metadata.rs
index fa33c3a18..bc7bc48c4 100644
--- a/bins/src/bin/gnostr-fetch-metadata.rs
+++ b/bins/src/bin/gnostr-fetch-metadata.rs
@@ -1,6 +1,7 @@
-use gnostr_types::{EventKind, Filter, PublicKeyHex};
use std::env;
+use gnostr_types::{EventKind, Filter, PublicKeyHex};
+
fn main() {
let mut args = env::args();
let _ = args.next(); // program name
diff --git a/bins/src/bin/gnostr-fetch-nip11.rs b/bins/src/bin/gnostr-fetch-nip11.rs
index 676dfb506..dd3dc5062 100644
--- a/bins/src/bin/gnostr-fetch-nip11.rs
+++ b/bins/src/bin/gnostr-fetch-nip11.rs
@@ -1,11 +1,12 @@
// TEMPORARILY
#![allow(clippy::uninlined_format_args)]
+use std::env;
+use std::time::Duration;
+
use gnostr_types::RelayInformationDocument;
use reqwest::blocking::Client;
use reqwest::redirect::Policy;
-use std::env;
-use std::time::Duration;
fn main() {
let mut args = env::args();
diff --git a/bins/src/bin/gnostr-fetch-pubkey-relays.rs b/bins/src/bin/gnostr-fetch-pubkey-relays.rs
index ec9cf388d..4cf9db26c 100644
--- a/bins/src/bin/gnostr-fetch-pubkey-relays.rs
+++ b/bins/src/bin/gnostr-fetch-pubkey-relays.rs
@@ -1,10 +1,9 @@
-use gnostr_types::{EventKind, Filter, PublicKeyHex};
use std::env;
-fn main() {
-
+use gnostr_types::{EventKind, Filter, PublicKeyHex};
-println!("{:#}",gnostr_bins::get_relays_public().unwrap());
+fn main() {
+ println!("{:#}", gnostr_bins::get_relays_public().unwrap());
let mut args = env::args();
let _ = args.next(); // program name
let relay_url = match args.next() {
diff --git a/bins/src/bin/gnostr-fetch-watch-list-iterator.rs b/bins/src/bin/gnostr-fetch-watch-list-iterator.rs
index 5963f03e0..9d43aef48 100644
--- a/bins/src/bin/gnostr-fetch-watch-list-iterator.rs
+++ b/bins/src/bin/gnostr-fetch-watch-list-iterator.rs
@@ -1,8 +1,6 @@
use futures::executor::block_on;
use gnostr_bins::print_watch_list;
fn main() {
-
let future = print_watch_list(); // Nothing is printed
block_on(future);
-
}
diff --git a/bins/src/bin/gnostr-fetch.rs b/bins/src/bin/gnostr-fetch.rs
index 64374a6d4..43bff8b4c 100644
--- a/bins/src/bin/gnostr-fetch.rs
+++ b/bins/src/bin/gnostr-fetch.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
@@ -14,9 +15,10 @@
#![deny(warnings)]
-use git2::{AutotagOption, FetchOptions, RemoteCallbacks, Repository};
use std::io::{self, Write};
use std::str;
+
+use git2::{AutotagOption, FetchOptions, RemoteCallbacks, Repository};
use structopt::StructOpt;
#[derive(StructOpt)]
@@ -89,8 +91,7 @@ fn run(args: &Args) -> Result<(), git2::Error> {
let stats = remote.stats();
if stats.local_objects() > 0 {
println!(
- "\rReceived {}/{} objects in {} bytes (used {} local \
- objects)",
+ "\rReceived {}/{} objects in {} bytes (used {} local objects)",
stats.indexed_objects(),
stats.total_objects(),
stats.received_bytes(),
diff --git a/bins/src/bin/gnostr-form-event-addr.rs b/bins/src/bin/gnostr-form-event-addr.rs
index 566b6ed22..1ec738ee5 100644
--- a/bins/src/bin/gnostr-form-event-addr.rs
+++ b/bins/src/bin/gnostr-form-event-addr.rs
@@ -1,12 +1,17 @@
-use gnostr_types::{EventAddr, EventKind, NostrUrl, PublicKey, UncheckedUrl};
use std::env;
+use gnostr_types::{EventAddr, EventKind, NostrUrl, PublicKey, UncheckedUrl};
+
fn main() {
let mut args = env::args();
let _ = args.next(); // program name
let usage = |msg| -> ! {
- panic!("{}\nUsage: form_event_addr <kind_number> <author_pubkeyhex> <d-identifier> [<relay_url> ...]", msg);
+ panic!(
+ "{}\nUsage: form_event_addr <kind_number> <author_pubkeyhex> <d-identifier> \
+ [<relay_url> ...]",
+ msg
+ );
};
let kind: EventKind = match args.next() {
diff --git a/bins/src/bin/gnostr-generate-keypair.rs b/bins/src/bin/gnostr-generate-keypair.rs
index e980652d9..bd51597ed 100644
--- a/bins/src/bin/gnostr-generate-keypair.rs
+++ b/bins/src/bin/gnostr-generate-keypair.rs
@@ -1,6 +1,7 @@
// Copyright 2022-2023 nostr-bins Developers
// Licensed under the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>
-// This file may not be copied, modified, or distributed except according to those terms.
+// This file may not be copied, modified, or distributed except according to
+// those terms.
use k256::schnorr::SigningKey;
use rand_core::OsRng;
diff --git a/bins/src/bin/gnostr-get-example.rs b/bins/src/bin/gnostr-get-example.rs
index b8c950acc..0557502cd 100644
--- a/bins/src/bin/gnostr-get-example.rs
+++ b/bins/src/bin/gnostr-get-example.rs
@@ -1,11 +1,9 @@
-use tokio::runtime::Runtime;
-
-use std::{io::Read, time::Instant};
+use std::io::Read;
+use std::time::{Instant, SystemTime, UNIX_EPOCH};
use gnostr_bins::get_blockheight;
use reqwest::Url;
-
-use std::time::{SystemTime, UNIX_EPOCH};
+use tokio::runtime::Runtime;
//use ureq::get;
diff --git a/bins/src/bin/gnostr-get-relays.rs b/bins/src/bin/gnostr-get-relays.rs
index 95bc0f110..7ccc6af22 100644
--- a/bins/src/bin/gnostr-get-relays.rs
+++ b/bins/src/bin/gnostr-get-relays.rs
@@ -1,9 +1,9 @@
-use gnostr_bins::get_relays;
-use reqwest::Url;
use std::io::Read;
-
use std::time::{SystemTime, UNIX_EPOCH};
+use gnostr_bins::get_relays;
+use reqwest::Url;
+
fn main() {
let since_the_epoch = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
diff --git a/bins/src/bin/gnostr-init.rs b/bins/src/bin/gnostr-init.rs
index ee827087f..3df27a065 100644
--- a/bins/src/bin/gnostr-init.rs
+++ b/bins/src/bin/gnostr-init.rs
@@ -1,11 +1,13 @@
/*
- * libgit2 "init" example - shows how to initialize a new repo (also includes how to do an initial commit)
+ * libgit2 "init" example - shows how to initialize a new repo (also includes
+ * how to do an initial commit)
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
@@ -14,8 +16,9 @@
#![deny(warnings)]
-use git2::{Error, Repository, RepositoryInitMode, RepositoryInitOptions};
use std::path::{Path, PathBuf};
+
+use git2::{Error, Repository, RepositoryInitMode, RepositoryInitOptions};
use structopt::StructOpt;
#[derive(StructOpt)]
diff --git a/bins/src/bin/gnostr-legit.rs b/bins/src/bin/gnostr-legit.rs
index 03335ea07..dc29d0fd9 100644
--- a/bins/src/bin/gnostr-legit.rs
+++ b/bins/src/bin/gnostr-legit.rs
@@ -2,41 +2,32 @@
#![allow(unused)]
#![allow(dead_code)]
extern crate chrono;
-use chrono::offset::Utc;
-use chrono::DateTime;
-use std::process::Command;
//use std::time::SystemTime;
use std::any::type_name;
use std::convert::TryInto;
-use std::env;
use std::io::Result;
+use std::path::PathBuf;
+use std::process::Command;
use std::thread::sleep;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
+use std::{env, io, thread};
+
//use std::mem::size_of;
use argparse::{ArgumentParser, Store};
+use chrono::offset::Utc;
+use chrono::DateTime;
use git2::*;
use gitminer::Gitminer;
use pad::{Alignment, PadStr};
-use sha2::{Digest, Sha256};
-use std::{io, thread};
-
-use std::path::PathBuf; //for get_current_dir
+use sha2::{Digest, Sha256}; //for get_current_dir
extern crate gnostr_bins;
-use gnostr_bins::get_blockheight;
-use gnostr_bins::get_pwd;
-use gnostr_bins::get_weeble;
-use gnostr_bins::get_wobble;
-use gnostr_bins::gitminer;
-use gnostr_bins::post_event;
-use gnostr_bins::repo;
-use gnostr_bins::worker;
+use gnostr_bins::{
+ blockheight, get_blockheight, get_pwd, get_weeble, get_wobble, gitminer, post_event, repo,
+ weeble, wobble, worker,
+};
use gnostr_types::{ClientMessage, Event, Filter, RelayMessage, SubscriptionId};
-use gnostr_bins::blockheight;
-use gnostr_bins::weeble;
-use gnostr_bins::wobble;
-
//fn type_of<T>(_: T) -> &'static str {
// type_name::<T>()
//}
@@ -153,14 +144,16 @@ fn main() -> io::Result<()> {
// sed -e 's/\[/''/g' |
// sed -e 's/\]/''/g' |
// sed -e 's/"//g' |
- // awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}') 2>/dev/null
+ // awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}')
+ // 2>/dev/null
//echo $RELAYS
//}
//gnostr-get-relays
//#!/bin/bash
- //gnostr-git config --global --replace-all gnostr.relays "$(gnostr-get-relays)" #&& git config -l | grep gnostr.relays
+ //gnostr-git config --global --replace-all gnostr.relays "$(gnostr-get-relays)"
+ // #&& git config -l | grep gnostr.relays
#[allow(clippy::if_same_then_else)]
let set_relays = if cfg!(target_os = "windows") {
Command::new("cmd")
@@ -323,13 +316,15 @@ fn main() -> io::Result<()> {
//println!("&hash before: {:?}", &hash);
//println!("&hash after pad: {:?}", &hash);
//println!("gnostr_sec before pad: {:?}", gnostr_sec);
- //println!("gnostr_sec after pad: {:?}", gnostr_sec.pad(64, '0', Alignment::Right, true));
- //println!("&gnostr_sec before pad: {:?}", &gnostr_sec);
- //println!("&gnostr_sec after pad: {:?}", &gnostr_sec.pad(64, '0', Alignment::Right, true));
+ //println!("gnostr_sec after pad: {:?}", gnostr_sec.pad(64, '0',
+ // Alignment::Right, true)); println!("&gnostr_sec before pad: {:?}",
+ // &gnostr_sec); println!("&gnostr_sec after pad: {:?}", &gnostr_sec.pad(64,
+ // '0', Alignment::Right, true));
//let s = "12345".pad(64, '0', Alignment::Right, true);
//println!("s: {:?}", s);
- // echo "000000b64a065760e5441bf47f0571cb690b28fc" | openssl dgst -sha256 | sed 's/SHA2-256(stdin)= //g'
+ // echo "000000b64a065760e5441bf47f0571cb690b28fc" | openssl dgst -sha256 | sed
+ // 's/SHA2-256(stdin)= //g'
//
//
//shell test
@@ -355,32 +350,48 @@ fn main() -> io::Result<()> {
//println!("351:{:?}", gnostr_bins::get_blockheight());
let event = if cfg!(target_os = "windows") {
Command::new("cmd")
- .args(["/C",
- "gnostr --sec $(gnostr-sha256 $(gnostr-weeble || echo)) -t gnostr --tag weeble $(gnostr-weeble || echo weeble) --tag wobble $(gnostr-wobble || echo wobble) --tag blockheight $(gnostr-blockheight || echo blockheight) --content \"$(git diff HEAD~1 || git diff)\" "
- ])
- .output()
- .expect("failed to execute process")
+ .args([
+ "/C",
+ "gnostr --sec $(gnostr-sha256 $(gnostr-weeble || echo)) -t gnostr --tag weeble \
+ $(gnostr-weeble || echo weeble) --tag wobble $(gnostr-wobble || echo wobble) \
+ --tag blockheight $(gnostr-blockheight || echo blockheight) --content \"$(git \
+ diff HEAD~1 || git diff)\" ",
+ ])
+ .output()
+ .expect("failed to execute process")
} else if cfg!(target_os = "macos") {
Command::new("sh")
- .args(["-c",
- "gnostr --sec $(gnostr-sha256 $(gnostr-weeble || echo)) -t gnostr --tag weeble $(gnostr-weeble || echo weeble) --tag wobble $(gnostr-wobble || echo wobble) --tag blockheight $(gnostr-blockheight || echo blockheight) --content \"$(git diff HEAD~1 || git diff)\" "
- ])
- .output()
- .expect("failed to execute process")
+ .args([
+ "-c",
+ "gnostr --sec $(gnostr-sha256 $(gnostr-weeble || echo)) -t gnostr --tag weeble \
+ $(gnostr-weeble || echo weeble) --tag wobble $(gnostr-wobble || echo wobble) \
+ --tag blockheight $(gnostr-blockheight || echo blockheight) --content \"$(git \
+ diff HEAD~1 || git diff)\" ",
+ ])
+ .output()
+ .expect("failed to execute process")
} else if cfg!(target_os = "linux") {
Command::new("sh")
- .args(["-c",
- "gnostr --sec $(gnostr-sha256 $(gnostr-weeble || echo)) -t gnostr --tag weeble $(gnostr-weeble || echo weeble) --tag wobble $(gnostr-wobble || echo wobble) --tag blockheight $(gnostr-blockheight || echo blockheight) --content \"$(git diff HEAD~1 || git diff)\" "
- ])
- .output()
- .expect("failed to execute process")
+ .args([
+ "-c",
+ "gnostr --sec $(gnostr-sha256 $(gnostr-weeble || echo)) -t gnostr --tag weeble \
+ $(gnostr-weeble || echo weeble) --tag wobble $(gnostr-wobble || echo wobble) \
+ --tag blockheight $(gnostr-blockheight || echo blockheight) --content \"$(git \
+ diff HEAD~1 || git diff)\" ",
+ ])
+ .output()
+ .expect("failed to execute process")
} else {
Command::new("sh")
- .args(["-c",
- "gnostr --sec $(gnostr-sha256 $(gnostr-weeble || echo)) -t gnostr --tag weeble $(gnostr-weeble || echo weeble) --tag wobble $(gnostr-wobble || echo wobble) --tag blockheight $(gnostr-blockheight || echo blockheight) --content \"$(git diff HEAD~1 || git diff)\" "
- ])
- .output()
- .expect("failed to execute process")
+ .args([
+ "-c",
+ "gnostr --sec $(gnostr-sha256 $(gnostr-weeble || echo)) -t gnostr --tag weeble \
+ $(gnostr-weeble || echo weeble) --tag wobble $(gnostr-wobble || echo wobble) \
+ --tag blockheight $(gnostr-blockheight || echo blockheight) --content \"$(git \
+ diff HEAD~1 || git diff)\" ",
+ ])
+ .output()
+ .expect("failed to execute process")
};
let gnostr_event = String::from_utf8(event.stdout)
@@ -395,14 +406,17 @@ fn main() -> io::Result<()> {
//to enable nested commands
//REF:
//gnostr --hash $(gnostr legit . -p 00000 -m "git rev-parse --verify HEAD")
- //gnostr --sec $(gnostr --hash $(gnostr legit . -p 00000 -m "git rev-parse --verify HEAD"))
- //Example:
- //gnostr --sec $(gnostr --hash $(gnostr legit . -p 00000 -m "#gnostr will exist!")) --envelope --content "$(git log -n 1)" | gnostr-cat -u wss://relay.damus.io
+ //gnostr --sec $(gnostr --hash $(gnostr legit . -p 00000 -m "git rev-parse
+ // --verify HEAD")) Example:
+ //gnostr --sec $(gnostr --hash $(gnostr legit . -p 00000 -m "#gnostr will
+ // exist!")) --envelope --content "$(git log -n 1)" | gnostr-cat -u
+ // wss://relay.damus.io
//
//
//
let duration = time::get_time() - start;
- //println!("Success! Generated commit {} in {} seconds", hash, duration.num_seconds());
+ //println!("Success! Generated commit {} in {} seconds", hash,
+ // duration.num_seconds());
//
//
//let relay_url = "wss://nos.lol";
@@ -419,9 +433,9 @@ fn parse_args_or_exit(opts: &mut gitminer::Options) {
ap.stop_on_first_argument(false);
//ap.refer(&mut opts.repo)
- // //.add_argument("repository-path", Store, "Path to your git repository (required)");
- // .add_argument("repository-path", Store, "Path to your git repository");
- // //.required();
+ // //.add_argument("repository-path", Store, "Path to your git repository
+ // (required)"); .add_argument("repository-path", Store, "Path to your
+ // git repository"); //.required();
ap.refer(&mut opts.repo)
.add_argument("repository-path", Store, "Path to your git repository");
@@ -446,7 +460,8 @@ fn parse_args_or_exit(opts: &mut gitminer::Options) {
//.required();
//ap.refer(&mut opts.timestamp)
- // .add_option(&["--timestamp"], Store, "Commit timestamp to use (default now)");
+ // .add_option(&["--timestamp"], Store, "Commit timestamp to use (default
+ // now)");
ap.parse_args_or_exit();
}
diff --git a/bins/src/bin/gnostr-log.rs b/bins/src/bin/gnostr-log.rs
index ad3bb354d..e19119405 100644
--- a/bins/src/bin/gnostr-log.rs
+++ b/bins/src/bin/gnostr-log.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
@@ -14,9 +15,11 @@
#![deny(warnings)]
-use git2::{Commit, DiffOptions, ObjectType, Repository, Signature, Time};
-use git2::{DiffFormat, Error, Pathspec};
use std::str;
+
+use git2::{
+ Commit, DiffFormat, DiffOptions, Error, ObjectType, Pathspec, Repository, Signature, Time,
+};
use structopt::StructOpt;
#[derive(StructOpt)]
diff --git a/bins/src/bin/gnostr-ls-remote.rs b/bins/src/bin/gnostr-ls-remote.rs
index 180845941..d0abd03f5 100644
--- a/bins/src/bin/gnostr-ls-remote.rs
+++ b/bins/src/bin/gnostr-ls-remote.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
diff --git a/bins/src/bin/gnostr-objects.rs b/bins/src/bin/gnostr-objects.rs
index 69d8a6ad3..683622da0 100644
--- a/bins/src/bin/gnostr-objects.rs
+++ b/bins/src/bin/gnostr-objects.rs
@@ -1,9 +1,8 @@
-use git2::Oid;
-use git2::{IndexAddOption, Repository};
-use std::env;
use std::ffi::OsString;
use std::path::Path;
-use std::process;
+use std::{env, process};
+
+use git2::{IndexAddOption, Oid, Repository};
fn car_cdr(s: &str) -> (&str, &str) {
for i in 1..5 {
@@ -19,8 +18,8 @@ fn car_cdr(s: &str) -> (&str, &str) {
pub fn oid_to_str(oid: &Oid) -> Result<String, &'static str> {
// Use the format!("{:x}", oid) for full 40-character hex string.
- // For a shorter representation, use oid.short_id() which returns a Result<Buf, Error>
- // and needs further conversion to String.
+ // For a shorter representation, use oid.short_id() which returns a Result<Buf,
+ // Error> and needs further conversion to String.
Ok(format!("{:#x?}", oid))
//Ok(format!("{:}", oid))
}
diff --git a/bins/src/bin/gnostr-pi.rs b/bins/src/bin/gnostr-pi.rs
index c535de1b2..26f01cf3b 100755
--- a/bins/src/bin/gnostr-pi.rs
+++ b/bins/src/bin/gnostr-pi.rs
@@ -1,5 +1,7 @@
+use std::str::FromStr;
+use std::{env, process};
+
use num_bigint::BigInt;
-use std::{env, process, str::FromStr};
fn help() {
println!("\ngnostr_pi\n");
diff --git a/bins/src/bin/gnostr-post-event.rs b/bins/src/bin/gnostr-post-event.rs
index 13b305bbe..6a205f50a 100644
--- a/bins/src/bin/gnostr-post-event.rs
+++ b/bins/src/bin/gnostr-post-event.rs
@@ -1,30 +1,45 @@
-use gnostr_types::Event;
use std::convert::TryInto;
-use std::env;
use std::io::Read;
-use std::process;
+use std::{env, process};
+
+use gnostr_types::Event;
fn main() {
//!
//! Usage: in context of other gnostr utilities
//!
- //! gnostr --sec $(gnostr-sha256) --content 'test' | gnostr-post-event wss://relay.damus.io
- //!
- //! gnostr --sec $(gnostr-sha256) --content "$(gnostr-git show HEAD)" | gnostr-post-event wss://relay.damus.io
+ //! gnostr --sec $(gnostr-sha256) --content 'test' | gnostr-post-event
+ //! wss://relay.damus.io
//!
- //! gnostr --sec $(gnostr-sha256) --content "$(gnostr-git-reflog -gd)" | gnostr-post-event wss://relay.damus.io
+ //! gnostr --sec $(gnostr-sha256) --content "$(gnostr-git show HEAD)" |
+ //! gnostr-post-event wss://relay.damus.io
//!
+ //! gnostr --sec $(gnostr-sha256) --content "$(gnostr-git-reflog -gd)" |
+ //! gnostr-post-event wss://relay.damus.io
- //! gnostr --sec $(gnostr-sha256 $(gnostr-weeble)) -t gnostr -t gnostr-get-relays --tag weeble $(gnostr-weeble) --tag wobble $(gnostr-wobble) --content "test" | ./target/debug/gnostr-post-event
+ //! gnostr --sec $(gnostr-sha256 $(gnostr-weeble)) -t gnostr -t
+ //! gnostr-get-relays --tag weeble $(gnostr-weeble) --tag wobble
+ //! $(gnostr-wobble) --content "test" | ./target/debug/gnostr-post-event
//!
- //! gnostr --sec $(gnostr-sha256 $(gnostr-weeble)) -t gnostr -t gnostr-get-relays --tag weeble $(gnostr-weeble) --tag wobble $(gnostr-wobble) --content "test" | ./target/debug/gnostr-post-event | sed 's/\\//g'
+ //! gnostr --sec $(gnostr-sha256 $(gnostr-weeble)) -t gnostr -t
+ //! gnostr-get-relays --tag weeble $(gnostr-weeble) --tag wobble
+ //! $(gnostr-wobble) --content "test" | ./target/debug/gnostr-post-event |
+ //! sed 's/\\//g'
//! Usage: in context of other gnostr utilities
//!
- //! gnostr --sec $(gnostr-sha256 $(gnostr-weeble)) -t gnostr -t gnostr-get-relays --tag weeble $(gnostr-weeble) --tag wobble $(gnostr-wobble) --content "gnostr\/$(gnostr-weeble)\/$(gnostr-blockheight)\/$(gnostr-wobble)" | ./target/debug/gnostr-post-event
+ //! gnostr --sec $(gnostr-sha256 $(gnostr-weeble)) -t gnostr -t
+ //! gnostr-get-relays --tag weeble $(gnostr-weeble) --tag wobble
+ //! $(gnostr-wobble) --content
+ //! "gnostr\/$(gnostr-weeble)\/$(gnostr-blockheight)\/$(gnostr-wobble)" |
+ //! ./target/debug/gnostr-post-event
//!
//!
- //! gnostr --sec $(gnostr-sha256 $(gnostr-weeble)) -t gnostr -t gnostr-get-relays --tag weeble $(gnostr-weeble) --tag wobble $(gnostr-wobble) --content "#gnostr/$(gnostr-weeble)/$(gnostr-blockheight)/$(gnostr-wobble)" | ./target/debug/gnostr-post-event
+ //! gnostr --sec $(gnostr-sha256 $(gnostr-weeble)) -t gnostr -t
+ //! gnostr-get-relays --tag weeble $(gnostr-weeble) --tag wobble
+ //! $(gnostr-wobble) --content
+ //! "#gnostr/$(gnostr-weeble)/$(gnostr-blockheight)/$(gnostr-wobble)" |
+ //! ./target/debug/gnostr-post-event
//!
//!
//! $(echo gnostr --sec $(gnostr-sha256)) | ./target/debug/gnostr-post-event
@@ -202,7 +217,11 @@ fn main() {
//let _ = args.next(); // program name
//let relay_url = match args.next() {
// Some(u) => u,
- // None => panic!("Usage:\ngnostr --sec $(gnostr-sha256) --content 'test' | gnostr-post-event wss://relay.damus.io\ngnostr --sec $(gnostr-sha256) --content \"$(gnostr-git show HEAD)\ngnostr --sec $(gnostr-sha256) --content \"$(gnostr-git-reflog -gd)\" | gnostr-post-event wss://relay.damus.io | gnostr-post-event wss://relay.damus.io"),
+ // None => panic!("Usage:\ngnostr --sec $(gnostr-sha256) --content 'test'
+ // | gnostr-post-event wss://relay.damus.io\ngnostr --sec $(gnostr-sha256)
+ // --content \"$(gnostr-git show HEAD)\ngnostr --sec $(gnostr-sha256)
+ // --content \"$(gnostr-git-reflog -gd)\" | gnostr-post-event
+ // wss://relay.damus.io | gnostr-post-event wss://relay.damus.io"),
//};
//let mut s: String = String::new();
diff --git a/bins/src/bin/gnostr-pull.rs b/bins/src/bin/gnostr-pull.rs
index 61251b481..5482bbe0f 100644
--- a/bins/src/bin/gnostr-pull.rs
+++ b/bins/src/bin/gnostr-pull.rs
@@ -1,20 +1,23 @@
/*
- * libgit2 "pull" example - shows how to pull remote data into a local branch.
+ * libgit2 "pull" example - shows how to pull remote data into a local
+ * branch.
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
-use git2::Repository;
use std::io::{self, Write};
use std::str;
+
+use git2::Repository;
use structopt::StructOpt;
#[derive(StructOpt)]
@@ -64,8 +67,7 @@ fn do_fetch<'a>(
let stats = remote.stats();
if stats.local_objects() > 0 {
println!(
- "\rReceived {}/{} objects in {} bytes (used {} local \
- objects)",
+ "\rReceived {}/{} objects in {} bytes (used {} local objects)",
stats.indexed_objects(),
stats.total_objects(),
stats.received_bytes(),
@@ -99,9 +101,9 @@ fn fast_forward(
repo.set_head(&name)?;
repo.checkout_head(Some(
git2::build::CheckoutBuilder::default()
- // For some reason the force is required to make the working directory actually get updated
- // I suspect we should be adding some logic to handle dirty working directory states
- // but this is just an example so maybe not.
+ // For some reason the force is required to make the working directory actually get
+ // updated I suspect we should be adding some logic to handle dirty working
+ // directory states but this is just an example so maybe not.
.force(),
))?;
Ok(())
diff --git a/bins/src/bin/gnostr-reflog.rs b/bins/src/bin/gnostr-reflog.rs
index c60347a4e..7d6ecd200 100644
--- a/bins/src/bin/gnostr-reflog.rs
+++ b/bins/src/bin/gnostr-reflog.rs
@@ -1,10 +1,8 @@
extern crate getopts;
+use std::{env, process};
+
use getopts::Options;
use git2::Repository;
-
-use std::env;
-use std::process;
-
use gnostr_bins::get_pwd;
pub fn ref_hash_list_padded(_program: &str, _opts: &Options) -> Result<(), git2::Error> {
@@ -67,12 +65,12 @@ pub fn ref_hash_list_w_commit_message(_program: &str, _opts: &Options) -> Result
mod std_input {
extern crate getopts;
- use crate::ref_hash_list;
+ use std::{env, io, process};
+
use ascii::AsciiChar;
use getopts::Options;
- use std::env;
- use std::io;
- use std::process;
+
+ use crate::ref_hash_list;
#[allow(dead_code)]
pub fn parse_input() {
@@ -214,11 +212,15 @@ pub fn main() -> Result<(), git2::Error> {
//gnostr_bins::hash_list();
//process::exit(0);
// COMMAND CONTEXT:
- // for m in $(gnostr-reflog -p);do echo $m; for n in $(gnostr-reflog);do echo $n;done;done
- // for m in $(gnostr-reflog -p); do gnostr --sec $m --content "$(for n in $(gnostr-reflog); do echo $n;done)";done
- // for m in $(gnostr-reflog -p); do gnostr --sec $m --content "$(for n in $(gnostr-reflog); do echo $n;done)";done
- // for m in $(gnostr-reflog -p); do gnostr --sec $m --content "$(for n in $(gnostr-reflog); do echo $n;done)" | gnostr-xq ;done
- // for m in $(gnostr-reflog -p); do gnostr --sec $m --content "$(for n in $(gnostr-reflog); do echo $n;done)" | gnostr-post-event --relay wss://relay.damus.io ;done
+ // for m in $(gnostr-reflog -p);do echo $m; for n in $(gnostr-reflog);do echo
+ // $n;done;done for m in $(gnostr-reflog -p); do gnostr --sec $m --content
+ // "$(for n in $(gnostr-reflog); do echo $n;done)";done
+ // for m in $(gnostr-reflog -p); do gnostr --sec $m --content "$(for n in
+ // $(gnostr-reflog); do echo $n;done)";done for m in $(gnostr-reflog -p); do
+ // gnostr --sec $m --content "$(for n in $(gnostr-reflog); do echo $n;done)" |
+ // gnostr-xq ;done for m in $(gnostr-reflog -p); do gnostr --sec $m
+ // --content "$(for n in $(gnostr-reflog); do echo $n;done)" | gnostr-post-event
+ // --relay wss://relay.damus.io ;done
let args: Vec<String> = env::args().collect();
let program = args[0].clone();
diff --git a/bins/src/bin/gnostr-rev-list.rs b/bins/src/bin/gnostr-rev-list.rs
index 9b4987728..4d891e21a 100644
--- a/bins/src/bin/gnostr-rev-list.rs
+++ b/bins/src/bin/gnostr-rev-list.rs
@@ -4,9 +4,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
diff --git a/bins/src/bin/gnostr-rev-parse.rs b/bins/src/bin/gnostr-rev-parse.rs
index a465f15a4..296fa938e 100644
--- a/bins/src/bin/gnostr-rev-parse.rs
+++ b/bins/src/bin/gnostr-rev-parse.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
diff --git a/bins/src/bin/gnostr-sha256.rs b/bins/src/bin/gnostr-sha256.rs
index f43b63d20..ffa96317a 100644
--- a/bins/src/bin/gnostr-sha256.rs
+++ b/bins/src/bin/gnostr-sha256.rs
@@ -1,18 +1,16 @@
-use std::env;
use std::io::Result;
-use std::process;
+use std::{env, process};
//time functions
extern crate chrono;
extern crate time;
-use chrono::{DateTime, Utc};
-use std::time::{SystemTime, UNIX_EPOCH};
-
#[cfg(debug_assertions)]
use std::path::PathBuf;
#[cfg(not(debug_assertions))]
use std::path::PathBuf;
+use std::time::{SystemTime, UNIX_EPOCH};
+use chrono::{DateTime, Utc};
#[allow(unused_imports)]
use gnostr_bins::run;
#[allow(unused_imports)]
@@ -127,9 +125,10 @@ fn main() -> Result<()> {
#[cfg(test)]
mod tests {
- use super::*;
use sha256::digest;
+ use super::*;
+
#[test]
fn strip_newline_works() {
assert_eq!(strip_trailing_newline("Test0\r\n\r\n"), "Test0\r\n");
diff --git a/bins/src/bin/gnostr-state.rs b/bins/src/bin/gnostr-state.rs
index ff2434b60..d3624717c 100644
--- a/bins/src/bin/gnostr-state.rs
+++ b/bins/src/bin/gnostr-state.rs
@@ -1,8 +1,9 @@
-use git2::{IndexAddOption, Repository};
use std::ffi::OsString;
use std::path::Path;
use std::process;
+use git2::{IndexAddOption, Repository};
+
fn main() -> Result<(), git2::Error> {
// Get path to git repo via command line args or assume current directory
let repo_root: OsString = std::env::args_os()
diff --git a/bins/src/bin/gnostr-status.rs b/bins/src/bin/gnostr-status.rs
index 4f7bc791c..7e38088e5 100644
--- a/bins/src/bin/gnostr-status.rs
+++ b/bins/src/bin/gnostr-status.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
@@ -14,9 +15,10 @@
#![deny(warnings)]
-use git2::{Error, ErrorCode, Repository, StatusOptions, SubmoduleIgnore};
use std::str;
use std::time::Duration;
+
+use git2::{Error, ErrorCode, Repository, StatusOptions, SubmoduleIgnore};
use structopt::StructOpt;
#[derive(StructOpt)]
@@ -235,8 +237,7 @@ fn print_long(statuses: &git2::Statuses) {
# Changes not staged for commit:
# (use \"git add{} <file>...\" to update what will be committed)
# (use \"git checkout -- <file>...\" to discard changes in working directory)
-#\
- ",
+#",
if rm_in_workdir { "/rm" } else { "" }
);
header = true;
@@ -298,10 +299,7 @@ fn print_long(statuses: &git2::Statuses) {
}
if !changes_in_index && changed_in_workdir {
- println!(
- "no changes added to commit (use \"git add\" and/or \
- \"git commit -a\")"
- );
+ println!("no changes added to commit (use \"git add\" and/or \"git commit -a\")");
}
}
diff --git a/bins/src/bin/gnostr-tag.rs b/bins/src/bin/gnostr-tag.rs
index c44c2887d..9aa16d725 100644
--- a/bins/src/bin/gnostr-tag.rs
+++ b/bins/src/bin/gnostr-tag.rs
@@ -3,9 +3,10 @@
*
* Written by the libgit2 contributors
*
- * To the extent possible under law, the author(s) have dedicated all copyright
- * and related and neighboring rights to this software to the public domain
- * worldwide. This software is distributed without any warranty.
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to the
+ * public domain worldwide. This software is distributed without any
+ * warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
@@ -14,8 +15,9 @@
#![deny(warnings)]
-use git2::{Commit, Error, Repository, Tag};
use std::str;
+
+use git2::{Commit, Error, Repository, Tag};
use structopt::StructOpt;
#[derive(StructOpt)]
diff --git a/bins/src/bin/gnostr-verify-keypair.rs b/bins/src/bin/gnostr-verify-keypair.rs
index d1a9b0610..78afda77e 100644
--- a/bins/src/bin/gnostr-verify-keypair.rs
+++ b/bins/src/bin/gnostr-verify-keypair.rs
@@ -1,13 +1,14 @@
// Copyright 2015-2020 nostr-bins Developers
// Licensed under the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>
-// This file may not be copied, modified, or distributed except according to those terms.
+// This file may not be copied, modified, or distributed except according to
+// those terms.
// TEMPORARILY
#![allow(clippy::uninlined_format_args)]
+use std::{env, process};
+
use k256::schnorr::{SigningKey, VerifyingKey};
-use std::env;
-use std::process;
fn main() {
let mut args = env::args();
diff --git a/bins/src/bin/gnostr-weeble.rs b/bins/src/bin/gnostr-weeble.rs
index d8cadc711..ba02d54a9 100644
--- a/bins/src/bin/gnostr-weeble.rs
+++ b/bins/src/bin/gnostr-weeble.rs
@@ -6,83 +6,83 @@
//
// WEEBLE WOBBLE is a timestamping method using bitcoin blockheight, utc
// time and a modulus function to create a unique, decentralized, yet
-// verifiable two part time stamp. weeble wobble was originally described in a
-// decentrailized version control proposal known as 0x20bf. The "weeble"
-// component of the time stamping method is simply floor(utc/block_height). The
-// wobble part of the time stamp is where weeble:wobble has more
+// verifiable two part time stamp. weeble wobble was originally described in
+// a decentrailized version control proposal known as 0x20bf. The "weeble"
+// component of the time stamping method is simply floor(utc/block_height).
+// The wobble part of the time stamp is where weeble:wobble has more
// interesting functionality. utc modulus block_height (utc % block_height).
// utc mod block_height measures the time between bitcoin blocks and can be
// adjusted to a varying granularity depending on specification needs.
// weeble functions as a network "minute hand" and wobble functions as a
-// network "second hand" (for example) but can be adjusted to milliseconds etc...
+// network "second hand" (for example) but can be adjusted to milliseconds
+// etc...
//
// WEEBLE WOBBLE Copyright (c) 2023 Randy McMillan
//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
//
// gnostr Copyright (c) 2023 Randy McMillan Gnostr.org
//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
//
// Gnostr.org Copyright (c) 2023 Randy McMillan Gnostr.org
//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
-use gnostr_bins::get_blockheight;
-use reqwest::Url;
use std::io::Read;
-
use std::time::{SystemTime, UNIX_EPOCH};
use futures::executor::block_on;
+use gnostr_bins::get_blockheight;
+use reqwest::Url;
async fn print_weeble() {
let since_the_epoch = SystemTime::now()
diff --git a/bins/src/bin/gnostr-welcome.rs b/bins/src/bin/gnostr-welcome.rs
index b169a925d..77f0a78f8 100755
--- a/bins/src/bin/gnostr-welcome.rs
+++ b/bins/src/bin/gnostr-welcome.rs
@@ -1,30 +1,24 @@
-use chrono::prelude::*;
-use crossterm::{
- event::{self, Event as CEvent, KeyCode},
- terminal::{disable_raw_mode, enable_raw_mode},
-};
-use rand::{distributions::Alphanumeric, prelude::*};
-use serde::{Deserialize, Serialize};
-use std::fs;
-use std::io;
-use std::process;
use std::sync::mpsc;
-use std::thread;
use std::time::{Duration, Instant};
-use thiserror::Error;
-use tui::{
- backend::CrosstermBackend,
- layout::{Alignment, Constraint, Direction, Layout},
- style::{Color, Modifier, Style},
- text::{Span, Spans},
- widgets::{
- Block, BorderType, Borders, Cell, List, ListItem, ListState, Paragraph, Row, Table, Tabs,
- },
- Terminal,
-};
+use std::{fs, io, process, thread};
+use chrono::prelude::*;
+use crossterm::event::{self, Event as CEvent, KeyCode};
+use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
use homedir::get_my_home;
-const APP_NAME:&str = env!("CARGO_PKG_NAME");
+use rand::distributions::Alphanumeric;
+use rand::prelude::*;
+use serde::{Deserialize, Serialize};
+use thiserror::Error;
+use tui::backend::CrosstermBackend;
+use tui::layout::{Alignment, Constraint, Direction, Layout};
+use tui::style::{Color, Modifier, Style};
+use tui::text::{Span, Spans};
+use tui::widgets::{
+ Block, BorderType, Borders, Cell, List, ListItem, ListState, Paragraph, Row, Table, Tabs,
+};
+use tui::Terminal;
+const APP_NAME: &str = env!("CARGO_PKG_NAME");
const VERSION: &str = env!("CARGO_PKG_VERSION");
const ICON_FONT_SIZE: u16 = 12;
@@ -105,7 +99,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut terminal = Terminal::new(backend)?;
terminal.clear()?;
-
//MENU TITLES
let menu_titles = vec!["Home", "Relays", "Add", "Delete", "Quit"];
@@ -130,14 +123,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
)
.split(size);
- let copyright = Paragraph::new(format!(" {} FOOTER",APP_NAME))
+ let copyright = Paragraph::new(format!(" {} FOOTER", APP_NAME))
.style(Style::default().fg(Color::LightCyan))
.alignment(Alignment::Left)
.block(
Block::default()
.borders(Borders::ALL)
.style(Style::default().fg(Color::White))
- .title(format!(" {} v{}",APP_NAME,VERSION))
+ .title(format!(" {} v{}", APP_NAME, VERSION))
.border_type(BorderType::Plain),
);
@@ -180,7 +173,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
//footer not persist after quit here
rect.render_widget(copyright.clone(), chunks[2]);
-
}
}
})?;
@@ -234,136 +226,213 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
fn render_home<'a>() -> Paragraph<'a> {
let home = Paragraph::new(vec![
+ //REF: Unicode Character “█” (U+2588)
-//REF: Unicode Character “█” (U+2588)
-
-//center line
-//Spans::from(vec![Span::raw("
-//███████████████████████████████████████•███████████████████████████████████████
-//")]),
-Spans::from(vec![Span::raw("")]),
-Spans::from(vec![Span::raw("")]),
-Spans::from(vec![Span::raw("")]),
-Spans::from(vec![Span::raw("
- █•█ ")]),
-Spans::from(vec![Span::raw("
- ███•███ ")]),
-Spans::from(vec![Span::raw("
- █████•█████ ")]),
-Spans::from(vec![Span::raw("
- ███████•███████ ")]),
-Spans::from(vec![Span::raw("
- █████████•█████████ ")]),
-Spans::from(vec![Span::raw("
- ██████████•███████████ ")]),
-Spans::from(vec![Span::raw("
-█ ████████•█████████████")]),
-Spans::from(vec![Span::raw("
- ████ ██████•███████████████")]),
-Spans::from(vec![Span::raw("
- ████████ ███•█████████████████")]),
-Spans::from(vec![Span::raw("
- ████████████ █•███████████████████")]),
-Spans::from(vec![Span::raw("
- ████████████████ ██████████████████ ")]),
-Spans::from(vec![Span::raw("
+ //center line
+ //Spans::from(vec![Span::raw("
+ //███████████████████████████████████████•███████████████████████████████████████
+ //")]),
+ Spans::from(vec![Span::raw("")]),
+ Spans::from(vec![Span::raw("")]),
+ Spans::from(vec![Span::raw("")]),
+ Spans::from(vec![Span::raw(
+ "
+ █•█ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ███•███ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █████•█████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ███████•███████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █████████•█████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ██████████•███████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+█ ████████•█████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████ ██████•███████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████ ███•█████████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████████ █•███████████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████████████ ██████████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
██████████████████ ██████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
███████████████████ ███████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
█████████████████████ █████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
████████████████████████ ████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
████████████████████████████ ████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
███████████████████████████████ █ ████████████████████████
-")]),
-Spans::from(vec![Span::raw("
- ██████████████████████████████████ ███ ██████████████████████ ")]),
-Spans::from(vec![Span::raw("
-████████████████████████████████████ █████ ████████████████████")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ██████████████████████████████████ ███ ██████████████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+████████████████████████████████████ █████ ████████████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
█████████████████████████████████████ ███████ ██████████████████
-")]),
-//vim command to find center
-//:exe 'normal '.(virtcol('$')/2).'|'
-// █
-// ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▐ ▔ ▕ ▀ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▐ ▔ ▕
-// █
-// █
-//FULL BLOCK
-//Unicode: U+2588, UTF-8: E2 96 88
-
-//center line
-Spans::from(vec![Span::raw("
+",
+ )]),
+ //vim command to find center
+ //:exe 'normal '.(virtcol('$')/2).'|'
+ // █
+ // ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▐ ▔ ▕ ▀ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▐ ▔ ▕
+ // █
+ // █
+ //FULL BLOCK
+ //Unicode: U+2588, UTF-8: E2 96 88
+
+ //center line
+ Spans::from(vec![Span::raw(
+ "
█████████████████████████████████████ • ███████ █████████████████
-")]),
-
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
████████████████████████████████████ ████████ ████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
██████████████████████████████████ ██████████ ███████████████
-")]),
-Spans::from(vec![Span::raw("
-████████████████████████████████ ███████████████████████████████")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+████████████████████████████████ ███████████████████████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
███████████████████████████████ ██████████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
█████████████████████████████ ████████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
██████████████████████████ █████████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
██████████████████████ █████████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
███████████████████ ██████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
█████████████████ ████████████████
-")]),
-Spans::from(vec![Span::raw("
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
████████████████ ███████████████
-")]),
-Spans::from(vec![Span::raw("
-████████████████ ███████████████")]),
-Spans::from(vec![Span::raw("
- ████████████████•████████████████ ")]),
-Spans::from(vec![Span::raw("
- ██████████████•██████████████ ")]),
-Spans::from(vec![Span::raw("
- ████████████•████████████ ")]),
-Spans::from(vec![Span::raw("
- █████████•█████████ ")]),
-Spans::from(vec![Span::raw("
- ███████•███████ ")]),
-Spans::from(vec![Span::raw("
- █████•█████ ")]),
-Spans::from(vec![Span::raw("
- ███•███ ")]),
-Spans::from(vec![Span::raw("
- █•█ ")]),
-//center line
-//Spans::from(vec![Span::raw("
-//███████████████████████████████████████•███████████████████████████████████████
-//")]),
-
-
+",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+████████████████ ███████████████",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████████████•████████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ██████████████•██████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ████████████•████████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █████████•█████████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ███████•███████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █████•█████ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ ███•███ ",
+ )]),
+ Spans::from(vec![Span::raw(
+ "
+ █•█ ",
+ )]),
+ //center line
+ //Spans::from(vec![Span::raw("
+ //███████████████████████████████████████•███████████████████████████████████████
+ //")]),
Spans::from(vec![Span::styled(
" ",
Style::default().fg(Color::LightBlue),
)]),
Spans::from(vec![Span::raw("")]),
- //Spans::from(vec![Span::raw("Press 'p' to access pets, 'a' to add random new pets and 'd' to delete the currently selected pet.")]),
+ //Spans::from(vec![Span::raw("Press 'p' to access pets, 'a' to add random new pets and 'd'
+ // to delete the currently selected pet.")]),
])
.alignment(Alignment::Center)
.block(
diff --git a/bins/src/bin/gnostr-wobble.rs b/bins/src/bin/gnostr-wobble.rs
index 48117a074..d566bebe4 100644
--- a/bins/src/bin/gnostr-wobble.rs
+++ b/bins/src/bin/gnostr-wobble.rs
@@ -6,83 +6,83 @@
//
// WEEBLE WOBBLE is a timestamping method using bitcoin blockheight, utc
// time and a modulus function to create a unique, decentralized, yet
-// verifiable two part time stamp. weeble wobble was originally described in a
-// decentrailized version control proposal known as 0x20bf. The "weeble"
-// component of the time stamping method is simply floor(utc/block_height). The
-// wobble part of the time stamp is where weeble:wobble has more
+// verifiable two part time stamp. weeble wobble was originally described in
+// a decentrailized version control proposal known as 0x20bf. The "weeble"
+// component of the time stamping method is simply floor(utc/block_height).
+// The wobble part of the time stamp is where weeble:wobble has more
// interesting functionality. utc modulus block_height (utc % block_height).
// utc mod block_height measures the time between bitcoin blocks and can be
// adjusted to a varying granularity depending on specification needs.
// weeble functions as a network "minute hand" and wobble functions as a
-// network "second hand" (for example) but can be adjusted to milliseconds etc...
+// network "second hand" (for example) but can be adjusted to milliseconds
+// etc...
//
// WEEBLE WOBBLE Copyright (c) 2023 Randy McMillan
//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
//
// gnostr Copyright (c) 2023 Randy McMillan Gnostr.org
//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
//
// Gnostr.org Copyright (c) 2023 Randy McMillan Gnostr.org
//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
-use gnostr_bins::get_blockheight;
-use reqwest::Url;
use std::io::Read;
-
use std::time::{SystemTime, UNIX_EPOCH};
use futures::executor::block_on;
+use gnostr_bins::get_blockheight;
+use reqwest::Url;
async fn print_wobble() {
let since_the_epoch = SystemTime::now()
diff --git a/bins/src/bin/nostr.rs b/bins/src/bin/nostr.rs
index 1ef9db0a3..24bc8db73 100644
--- a/bins/src/bin/nostr.rs
+++ b/bins/src/bin/nostr.rs
@@ -1,18 +1,15 @@
-use std::env;
use std::iter::Peekable;
+use std::str::FromStr;
+use std::sync::{Arc, Mutex};
+use std::{env, thread};
+
+use nostr_rust::events::extract_events_ws;
+use nostr_rust::nostr_client::Client;
+use nostr_rust::req::ReqFilter;
+use nostr_rust::utils::parse_content_tags;
+use nostr_rust::{Identity, Message};
use structopt::StructOpt;
-use std::{
- str::FromStr,
- sync::{Arc, Mutex},
- thread,
-};
-
-use nostr_rust::{
- events::extract_events_ws, nostr_client::Client, req::ReqFilter, utils::parse_content_tags,
- Identity, Message,
-};
-
fn handle_message(relay_url: &String, message: &Message) -> Result<(), String> {
println!("Received message from {}: {:?}", relay_url, message);
@@ -87,10 +84,10 @@ fn main() {
.unsubscribe(&subscription_id)
.unwrap();
- // You can use the parse content tags method to get the content and the tags from a string
- // let tags = parse_content_tags("hello #world", vec![], Some(nostr_rust::DEFAULT_HASHTAG), true, true);
- // assert_eq!(tags.content, "hello #world");
- // assert_eq!(tags.tags, vec![vec!["t", "world"]]);
+ // You can use the parse content tags method to get the content and the tags
+ // from a string let tags = parse_content_tags("hello #world", vec![],
+ // Some(nostr_rust::DEFAULT_HASHTAG), true, true); assert_eq!(tags.content,
+ // "hello #world"); assert_eq!(tags.tags, vec![vec!["t", "world"]]);
// Publish a text note
nostr_client