Skip to content

Commit d72523d

Browse files
committed
Implicit shielded-sync as child process
1 parent e5bc7a2 commit d72523d

File tree

4 files changed

+154
-252
lines changed

4 files changed

+154
-252
lines changed

crates/apps_lib/src/cli.rs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const WALLET_CMD: &str = "wallet";
3131
const RELAYER_CMD: &str = "relayer";
3232

3333
pub mod cmds {
34+
use std::fmt::Display;
35+
3436
use super::args::CliTypes;
3537
use super::utils::*;
3638
use super::{
@@ -1632,6 +1634,68 @@ pub mod cmds {
16321634
}
16331635
}
16341636

1637+
impl Display for ShieldedSync {
1638+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1639+
use crate::cli::args;
1640+
1641+
write!(f, "{} ", Self::CMD)?;
1642+
1643+
let args::ShieldedSync {
1644+
last_query_height,
1645+
spending_keys,
1646+
viewing_keys,
1647+
with_indexer,
1648+
wait_for_last_query_height,
1649+
max_concurrent_fetches,
1650+
block_batch_size,
1651+
retry_strategy,
1652+
} = &self.0;
1653+
1654+
if let Some(lqh) = last_query_height {
1655+
write!(f, "--{} {} ", args::BLOCK_HEIGHT_TO_OPT.name, lqh)?;
1656+
}
1657+
1658+
if !spending_keys.is_empty() {
1659+
write!(f, "--{} ", args::DATED_SPENDING_KEYS.name)?;
1660+
1661+
for key in spending_keys {
1662+
write!(f, "{} ", key.raw)?;
1663+
}
1664+
}
1665+
1666+
if !viewing_keys.is_empty() {
1667+
write!(f, "--{} ", args::DATED_VIEWING_KEYS.name)?;
1668+
1669+
for key in viewing_keys {
1670+
write!(f, "{} ", key.raw)?;
1671+
}
1672+
}
1673+
1674+
if let Some(indexer) = with_indexer {
1675+
write!(f, "--{} {} ", args::WITH_INDEXER.name, indexer)?;
1676+
}
1677+
1678+
if *wait_for_last_query_height {
1679+
write!(f, "--{} ", args::WAIT_FOR_LAST_QUERY_HEIGHT.name)?;
1680+
}
1681+
1682+
write!(
1683+
f,
1684+
"--{} {} ",
1685+
args::MAX_CONCURRENT_FETCHES.name,
1686+
max_concurrent_fetches
1687+
)?;
1688+
write!(f, "--{} {} ", args::BLOCK_BATCH.name, block_batch_size)?;
1689+
if let namada_sdk::masp::utils::RetryStrategy::Times(retries) =
1690+
retry_strategy
1691+
{
1692+
write!(f, "--{} {} ", args::RETRIES.name, retries)?;
1693+
}
1694+
1695+
Ok(())
1696+
}
1697+
}
1698+
16351699
#[derive(Clone, Debug)]
16361700
pub struct Bond(pub args::Bond<args::CliTypes>);
16371701

0 commit comments

Comments
 (0)