Why Nostr? What is Njump?
2024-07-03 00:49:39

npub1td…ff0wq on Nostr: commit cd801f30bacaaca7dcd3ff4d2f8864d9bfcc60e4 Author: randymcmillan ...

commit cd801f30bacaaca7dcd3ff4d2f8864d9bfcc60e4
Author: randymcmillan <[email protected]>
Date: Tue May 14 14:54:00 2024 -0400

src/bin/gnostr-get-relays.rs:apply cargo +nightly fmt

diff --git a/bins/src/bin/gnostr-get-relays.rs b/bins/src/bin/gnostr-get-relays.rs
index c666d983c..46b2a0917 100644
--- a/bins/src/bin/gnostr-get-relays.rs
+++ b/bins/src/bin/gnostr-get-relays.rs
@@ -1,10 +1,8 @@
-use futures::executor::block_on;
-use gnostr_bins::get_stripped_urls;
-use gnostr_bins::print_watch_list;
-use gnostr_bins::get_watch_list;
-use gnostr_bins::get_watch_list_json;
use std::env;

+use futures::executor::block_on;
+use gnostr_bins::{get_stripped_urls, get_watch_list, get_watch_list_json, print_watch_list};
+
pub fn handle_command(mut args: env::Args) -> Result<bool, Box<dyn std::error::Error>> {
let _ = args.next(); // program name
let command = args.next().unwrap(); // must be there or we would not have been called
@@ -32,8 +30,6 @@ pub fn handle_command(mut args: env::Args) -> Result<bool, Box<dyn std::error::E
"--stripped" => stripped(),
"stripped" => stripped(),

-
-
//version
"-V" => version(),
//support help2man
@@ -45,12 +41,11 @@ pub fn handle_command(mut args: env::Args) -> Result<bool, Box<dyn std::error::E
"--help" => help(),
"help" => help(),
//other
- other => println!("Unknown command {}", other),
-
+ other => println!("Unknown command {}", other),
}
Ok(true)
}
-fn default(){
+fn default() {
json();
use std::process;
process::exit(0);
@@ -72,14 +67,14 @@ fn stripped() {
let future = get_stripped_urls();
let length = block_on(future);
//print!("{}",format!("{:?}",length.unwrap()));
- print!("{}",format!("{:?}",length.expect("REASON").len()));
+ print!("{}", format!("{:?}", length.expect("REASON").len()));
}
-fn help(){
+fn help() {
use std::process;

let crate_name = env!("CARGO_CRATE_NAME");
-let version = env!("CARGO_PKG_VERSION");
- print!("\n{} v{}\n\n", crate_name.replace("_", "-"),version);
+ let version = env!("CARGO_PKG_VERSION");
+ print!("\n{} v{}\n\n", crate_name.replace("_", "-"), version);
print!("{} get\n", crate_name.replace("_", "-"));
print!(" <csv_relay_list>\n");
print!("{} json\n", crate_name.replace("_", "-"));
@@ -88,32 +83,33 @@ let version = env!("CARGO_PKG_VERSION");
print!(" <string_relay_list> <int_length_last>\n");
process::exit(0);
}
-fn version(){
+fn version() {
use std::process;

print!("");

-let version = env!("CARGO_PKG_VERSION");
-let crate_name = env!("CARGO_CRATE_NAME");
-//let name = env!("CARGO_PKG_NAME");
-//let author = env!("CARGO_PKG_AUTHORS");
+ let version = env!("CARGO_PKG_VERSION");
+ let crate_name = env!("CARGO_CRATE_NAME");
+ //let name = env!("CARGO_PKG_NAME");
+ //let author = env!("CARGO_PKG_AUTHORS");

-//println!("Program Name: {}", name);
-//println!("Program Version: {}", version);
-println!("{} v{}", crate_name.replace("_", "-"),version);
-//println!("Program Version: {}", version);
-//println!("Program Author: {}", author);
+ //println!("Program Name: {}", name);
+ //println!("Program Version: {}", version);
+ println!("{} v{}", crate_name.replace("_", "-"), version);
+ //println!("Program Version: {}", version);
+ //println!("Program Author: {}", author);

process::exit(0);
}
fn main() {
-
use std::process;
// If we were handed a command, execute the command and return
let args = env::args();
if args.len() > 1 {
- let _ = handle_command(env::args());
- } else {default();}
+ let _ = handle_command(env::args());
+ } else {
+ default();
+ }
//if args.len() > 1 {
// for arg in args {
// if arg == "json" {json();process::exit(0)}
Author Public Key
npub1tddyhrd465fxn49990kdxptq5twc4fm7g5j5qd5579hzsjgflzysgff0wq