mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-29 05:50:31 +08:00
cli: Improve rad remote add
By default, this command now: * Follows the peer if not already followed * Syncs refs of the peer, if it wasn't followed before * Fetches refs into working copy This functionality can be disabled via `--no-sync` and `--no-fetch`.
This commit is contained in:
@@ -7,8 +7,9 @@ use radicle::Node;
|
||||
|
||||
use crate::terminal as term;
|
||||
|
||||
pub fn sync(rid: Id, node: &mut Node) -> anyhow::Result<()> {
|
||||
match sync_(rid, node) {
|
||||
/// Announce changes to the network.
|
||||
pub fn announce(rid: Id, node: &mut Node) -> anyhow::Result<()> {
|
||||
match announce_(rid, node) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(e) if e.is_connection_err() => {
|
||||
term::hint("Node is stopped. To announce changes to the network, start it with `rad node start`.");
|
||||
@@ -18,8 +19,7 @@ pub fn sync(rid: Id, node: &mut Node) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Sync with the network.
|
||||
fn sync_(rid: Id, node: &mut Node) -> Result<(), radicle::node::Error> {
|
||||
fn announce_(rid: Id, node: &mut Node) -> Result<(), radicle::node::Error> {
|
||||
let seeds = node.seeds(rid)?;
|
||||
let connected = seeds.connected().map(|s| s.nid).collect::<Vec<_>>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user