diff --git a/radicle-cli/examples/rad-remote.md b/radicle-cli/examples/rad-remote.md index f7b31531..14d1f867 100644 --- a/radicle-cli/examples/rad-remote.md +++ b/radicle-cli/examples/rad-remote.md @@ -51,3 +51,44 @@ $ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk ✓ Remote bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk added ✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67…v4N1tRk ``` + +We can also use `rad remote` to list all the remotes that are +available in the repository by using the `--untracked` flag: + +``` +$ rad remote --untracked +eve did:key:z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z +``` + +If we use `--all`, then we can see all the remotes that we have +created in the working copy, followed by all the available remotes: + +``` +$ rad remote --all +bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (fetch) +rad (canonical upstream) (fetch) +rad z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (push) + +eve did:key:z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z +``` + +As we can see, we have also have another remote namespace `eve`, so +let's add them to our set of working copy remotes: + +``` +$ rad remote add did:key:z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z --name eve +✓ Remote eve added +✓ Remote-tracking branch eve/master created for z6Mkux1…nVhib7Z +``` + +After adding `eve`'s remote, we no longer see any entries that are +untracked: + +``` +$ rad remote --all +bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (fetch) +eve z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z (fetch) +rad (canonical upstream) (fetch) +rad z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (push) +``` + diff --git a/radicle-cli/src/commands/remote.rs b/radicle-cli/src/commands/remote.rs index e06dd440..b031eb1b 100644 --- a/radicle-cli/src/commands/remote.rs +++ b/radicle-cli/src/commands/remote.rs @@ -14,6 +14,7 @@ use radicle::git::RefString; use radicle::prelude::NodeId; use radicle::storage::ReadStorage; +use crate::terminal as term; use crate::terminal::args; use crate::terminal::{Args, Context, Help}; @@ -24,19 +25,28 @@ pub const HELP: Help = Help { usage: r#" Usage - rad remote - rad remote list - rad remote add ( | ) [--name ] - rad remote rm + rad remote [