bin/darkwiki: add dry merge and show patches log for darkwiki cli

This commit is contained in:
ghassmo
2022-08-20 10:05:45 +04:00
parent 2f0e2b73da
commit ab1cd1faf8
2 changed files with 15 additions and 4 deletions

View File

@@ -12,10 +12,15 @@ use darkfi::{
#[derive(Clone, Debug, StructOpt)]
#[structopt(name = "darkwikiupdate")]
struct Args {
#[structopt(long)]
/// Merge/Update without applying the changes
dry_run: bool,
#[structopt(long)]
/// Show all patches info
log: bool,
#[structopt(short, parse(from_occurrences))]
/// Increase verbosity (-vvv supported)
verbose: u8,
#[structopt(short, long, default_value = "tcp://127.0.0.1:13055")]
/// darkfid JSON-RPC endpoint
endpoint: Url,
@@ -31,8 +36,14 @@ async fn main() -> Result<()> {
let rpc_client = RpcClient::new(args.endpoint).await?;
let req = JsonRequest::new("update", json!([]));
rpc_client.request(req).await?;
let req = if args.dry_run {
JsonRequest::new("dry_run", json!([]))
} else if args.log {
JsonRequest::new("log", json!([]))
} else {
JsonRequest::new("update", json!([]))
};
rpc_client.request(req).await?;
rpc_client.close().await
}

View File

@@ -229,7 +229,7 @@ impl<T: Decodable + Encodable + Clone> Raft<T> {
break
}
Role::Candidate => {
util::sleep(2).await;
util::sleep(1).await;
}
}
}