From 3acdeabfc3ab55d3e92d76d92d8ab6ad0383dd09 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 31 Jul 2024 15:59:17 +0100 Subject: feat(remote): `push` issues state event if no previous state events can be found it replicates git server otherwise it just updates pushed value --- src/sub_commands/init.rs | 2 ++ src/sub_commands/login.rs | 2 ++ src/sub_commands/push.rs | 2 ++ src/sub_commands/send.rs | 11 +++++++++-- 4 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/sub_commands') diff --git a/src/sub_commands/init.rs b/src/sub_commands/init.rs index ba188c9..bb437a5 100644 --- a/src/sub_commands/init.rs +++ b/src/sub_commands/init.rs @@ -89,6 +89,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { &cli_args.password, Some(&client), false, + false, ) .await?; @@ -330,6 +331,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { user_ref.relays.write(), relays.clone(), !cli_args.disable_cli_spinners, + false, ) .await?; diff --git a/src/sub_commands/login.rs b/src/sub_commands/login.rs index 77fecdd..8a3788f 100644 --- a/src/sub_commands/login.rs +++ b/src/sub_commands/login.rs @@ -25,6 +25,7 @@ pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { &args.password, None, true, + false, ) .await?; Ok(()) @@ -42,6 +43,7 @@ pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { &args.password, Some(&client), true, + false, ) .await?; client.disconnect().await?; diff --git a/src/sub_commands/push.rs b/src/sub_commands/push.rs index 56927fe..7a82c7a 100644 --- a/src/sub_commands/push.rs +++ b/src/sub_commands/push.rs @@ -178,6 +178,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { &cli_args.password, Some(&client), false, + false, ) .await?; @@ -212,6 +213,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { user_ref.relays.write(), repo_ref.relays.clone(), !cli_args.disable_cli_spinners, + false, ) .await?; diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 07eb343..f10d2d3 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs @@ -3,7 +3,7 @@ use std::{path::Path, str::FromStr, time::Duration}; use anyhow::{bail, Context, Result}; use console::Style; use futures::future::join_all; -use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; +use indicatif::{MultiProgress, ProgressBar, ProgressDrawTarget, ProgressStyle}; use nostr::{ nips::{ nip01::Coordinate, @@ -195,6 +195,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re &cli_args.password, Some(&client), false, + false, ) .await?; @@ -244,6 +245,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re user_ref.relays.write(), repo_ref.relays.clone(), !cli_args.disable_cli_spinners, + false, ) .await?; @@ -285,6 +287,7 @@ pub async fn send_events( my_write_relays: Vec, repo_read_relays: Vec, animate: bool, + silent: bool, ) -> Result<()> { let fallback = [ client.get_fallback_relays().clone(), @@ -327,7 +330,11 @@ pub async fn send_events( } } - let m = MultiProgress::new(); + let m = if silent { + MultiProgress::with_draw_target(ProgressDrawTarget::hidden()) + } else { + MultiProgress::new() + }; let pb_style = ProgressStyle::with_template(if animate { " {spinner} {prefix} {bar} {pos}/{len} {msg}" } else { -- cgit v1.2.3