diff --git a/radicle-cli/examples/rad-init-sync.md b/radicle-cli/examples/rad-init-sync.md index 84e9c39e..d7cc0106 100644 --- a/radicle-cli/examples/rad-init-sync.md +++ b/radicle-cli/examples/rad-init-sync.md @@ -3,7 +3,7 @@ To create your first radicle project, navigate to a git repository, and run the `init` command: ``` -$ rad init --name heartwood --description "Radicle Heartwood Protocol & Stack" --no-confirm +$ rad init --name heartwood --description "Radicle Heartwood Protocol & Stack" --no-confirm --announce Initializing local 🌱 project in . @@ -14,11 +14,9 @@ Initializing local 🌱 project in . "defaultBranch": "master" } ✓ Syncing inventory.. +✓ Announcing inventory.. Your project id is rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji. You can show it any time by running: rad . -To publish your project to the network, run: - rad push - ``` diff --git a/radicle-cli/examples/rad-init.md b/radicle-cli/examples/rad-init.md index 5c3b2b5d..0b9c0526 100644 --- a/radicle-cli/examples/rad-init.md +++ b/radicle-cli/examples/rad-init.md @@ -3,7 +3,7 @@ To create your first radicle project, navigate to a git repository, and run the `init` command: ``` -$ rad init --name heartwood --description "Radicle Heartwood Protocol & Stack" --no-confirm --no-sync --no-track +$ rad init --name heartwood --description "Radicle Heartwood Protocol & Stack" --no-confirm --no-track Initializing local 🌱 project in . diff --git a/radicle-cli/src/commands/init.rs b/radicle-cli/src/commands/init.rs index 7d75f356..2a3f62a7 100644 --- a/radicle-cli/src/commands/init.rs +++ b/radicle-cli/src/commands/init.rs @@ -33,8 +33,8 @@ Options --default-branch The default branch of the project --set-upstream, -u Setup the upstream of the default branch --setup-signing Setup the radicle key as a signing key for this repository + --announce Announce the new project to the network --no-confirm Don't ask for confirmation during setup - --no-sync Don't announce the new project to the network --help Print help "#, }; @@ -48,7 +48,7 @@ pub struct Options { pub interactive: Interactive, pub setup_signing: bool, pub set_upstream: bool, - pub sync: bool, + pub announce: bool, pub track: bool, } @@ -65,7 +65,7 @@ impl Args for Options { let mut interactive = Interactive::Yes; let mut set_upstream = false; let mut setup_signing = false; - let mut sync = true; + let mut announce = false; let mut track = true; while let Some(arg) = parser.next()? { @@ -108,15 +108,12 @@ impl Args for Options { Long("setup-signing") => { setup_signing = true; } + Long("announce") => { + announce = true; + } Long("no-confirm") => { interactive = Interactive::No; } - Long("sync") => { - sync = true; - } - Long("no-sync") => { - sync = false; - } Long("no-track") => { track = false; } @@ -139,7 +136,7 @@ impl Args for Options { interactive, set_upstream, setup_signing, - sync, + announce, track, }, vec![], @@ -241,7 +238,8 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()> // Setup radicle signing key. self::setup_signing(profile.id(), &repo, interactive)?; } - if options.sync { + + if node.is_running() { let spinner = term::spinner("Syncing inventory.."); if let Err(e) = node.sync_inventory() { spinner.error(e); @@ -250,6 +248,15 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()> } } + if options.announce { + let spinner = term::spinner("Announcing inventory.."); + if let Err(e) = node.announce_inventory() { + spinner.error(e); + } else { + spinner.finish(); + } + } + term::blank(); term::info!( "Your project id is {}. You can show it any time by running:", @@ -257,9 +264,11 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()> ); term::indented(term::format::secondary("rad .")); - term::blank(); - term::info!("To publish your project to the network, run:"); - term::indented(term::format::secondary("rad push")); + if !options.announce { + term::blank(); + term::info!("To publish your project to the network, run:"); + term::indented(term::format::secondary("rad push")); + } term::blank(); } Err(err) => { diff --git a/radicle-cli/src/commands/push.rs b/radicle-cli/src/commands/push.rs index 85c65f24..8e9b6e34 100644 --- a/radicle-cli/src/commands/push.rs +++ b/radicle-cli/src/commands/push.rs @@ -15,15 +15,13 @@ pub const HELP: Help = Help { usage: r#" Usage - rad push [--all] [--[no-]sync] [