Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: do not require RID for sync inventory
Fintan Halpenny committed 2 years ago
commit ea31040ec6202d748d4465998213f91b213cdf71
parent ca9d2b44dfa7e62a0c6b08717200ab909de74df5
1 file changed +17 -10
modified radicle-cli/src/commands/sync.rs
@@ -298,15 +298,6 @@ impl Args for Options {

pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
    let profile = ctx.profile()?;
-
    let rid = match options.rid {
-
        Some(rid) => rid,
-
        None => {
-
            let (_, rid) =
-
                radicle::rad::cwd().context("Current directory is not a Radicle repository")?;
-

-
            rid
-
        }
-
    };
    let mut node = radicle::Node::new(profile.socket());
    if !node.is_running() {
        anyhow::bail!(
@@ -316,13 +307,29 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {

    match options.op {
        Operation::Status => {
+
            let rid = match options.rid {
+
                Some(rid) => rid,
+
                None => {
+
                    let (_, rid) = radicle::rad::cwd()
+
                        .context("Current directory is not a Radicle repository")?;
+
                    rid
+
                }
+
            };
            sync_status(rid, &mut node, &profile, &options)?;
        }
        Operation::Synchronize(SyncMode::Repo {
            settings,
            direction,
        }) => {
-
            let settings = settings.with_profile(&profile);
+
            let rid = match options.rid {
+
                Some(rid) => rid,
+
                None => {
+
                    let (_, rid) = radicle::rad::cwd()
+
                        .context("Current directory is not a Radicle repository")?;
+
                    rid
+
                }
+
            };
+
            let settings = settings.clone().with_profile(&profile);

            if [SyncDirection::Fetch, SyncDirection::Both].contains(&direction) {
                if !profile.policies()?.is_seeding(&rid)? {