From f2e96c96cec6315d95608d3a1e93b1a215eb6abd Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Wed, 15 Apr 2026 22:52:53 +0200 Subject: [PATCH] cli: Rename all `RepoId` args to `repo` Many commands take RIDs as arguments. Most of them call the corresponding struct member `repo`, some call it `rid`. For consistency, name these members `repo` for all commands. This change is intended to be invisible to the user. That is why, in some cases, the "long" version of the argument must be renamed to match `--rid`. --- crates/radicle-cli/src/commands/fork.rs | 2 +- crates/radicle-cli/src/commands/fork/args.rs | 2 +- crates/radicle-cli/src/commands/node.rs | 4 ++-- crates/radicle-cli/src/commands/node/args.rs | 4 ++-- crates/radicle-cli/src/commands/publish.rs | 2 +- crates/radicle-cli/src/commands/publish/args.rs | 2 +- crates/radicle-cli/src/commands/sync.rs | 8 ++++---- crates/radicle-cli/src/commands/sync/args.rs | 10 ++++++---- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/crates/radicle-cli/src/commands/fork.rs b/crates/radicle-cli/src/commands/fork.rs index 89692737..83781d36 100644 --- a/crates/radicle-cli/src/commands/fork.rs +++ b/crates/radicle-cli/src/commands/fork.rs @@ -14,7 +14,7 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> { let signer = profile.signer()?; let storage = &profile.storage; - let rid = match args.rid { + let rid = match args.repo { Some(rid) => rid, None => { let (_, rid) = rad::cwd().context("Current directory is not a Radicle repository")?; diff --git a/crates/radicle-cli/src/commands/fork/args.rs b/crates/radicle-cli/src/commands/fork/args.rs index 850a0b15..5ca9d1b9 100644 --- a/crates/radicle-cli/src/commands/fork/args.rs +++ b/crates/radicle-cli/src/commands/fork/args.rs @@ -19,7 +19,7 @@ pub struct Args { /// /// [example values: rad:z3Tr6bC7ctEg2EHmLvknUr29mEDLH, z3Tr6bC7ctEg2EHmLvknUr29mEDLH] #[arg(value_name = "RID")] - pub(super) rid: Option, + pub(super) repo: Option, } #[cfg(test)] diff --git a/crates/radicle-cli/src/commands/node.rs b/crates/radicle-cli/src/commands/node.rs index 3e8ffa86..f8cec865 100644 --- a/crates/radicle-cli/src/commands/node.rs +++ b/crates/radicle-cli/src/commands/node.rs @@ -72,9 +72,9 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> { events::run(node, count, timeout)?; } - Command::Routing { rid, nid, json } => { + Command::Routing { repo, nid, json } => { let store = profile.database()?; - routing::run(&store, rid, nid, json)?; + routing::run(&store, repo, nid, json)?; } Command::Logs { lines } => control::logs(lines, Some(time::Duration::MAX), &profile)?, Command::Start { diff --git a/crates/radicle-cli/src/commands/node/args.rs b/crates/radicle-cli/src/commands/node/args.rs index 44412b04..155ab360 100644 --- a/crates/radicle-cli/src/commands/node/args.rs +++ b/crates/radicle-cli/src/commands/node/args.rs @@ -147,8 +147,8 @@ pub(super) enum Command { json: bool, /// Show the routing table entries for the given RID - #[arg(long)] - rid: Option, + #[arg(long = "rid", value_name = "RID")] + repo: Option, /// Show the routing table entries for the given NID #[arg(long)] diff --git a/crates/radicle-cli/src/commands/publish.rs b/crates/radicle-cli/src/commands/publish.rs index 48406b94..2acf79b0 100644 --- a/crates/radicle-cli/src/commands/publish.rs +++ b/crates/radicle-cli/src/commands/publish.rs @@ -13,7 +13,7 @@ pub use args::Args; pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> { let profile = ctx.profile()?; - let rid = match args.rid { + let rid = match args.repo { Some(rid) => rid, None => radicle::rad::cwd() .map(|(_, rid)| rid) diff --git a/crates/radicle-cli/src/commands/publish/args.rs b/crates/radicle-cli/src/commands/publish/args.rs index bebdbc0e..51dfd036 100644 --- a/crates/radicle-cli/src/commands/publish/args.rs +++ b/crates/radicle-cli/src/commands/publish/args.rs @@ -21,7 +21,7 @@ pub struct Args { /// /// [example values: rad:z3Tr6bC7ctEg2EHmLvknUr29mEDLH, z3Tr6bC7ctEg2EHmLvknUr29mEDLH] #[arg(value_name = "RID")] - pub(super) rid: Option, + pub(super) repo: Option, } #[cfg(test)] diff --git a/crates/radicle-cli/src/commands/sync.rs b/crates/radicle-cli/src/commands/sync.rs index ac1dd937..0bbb0b07 100644 --- a/crates/radicle-cli/src/commands/sync.rs +++ b/crates/radicle-cli/src/commands/sync.rs @@ -40,8 +40,8 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> { let debug = args.verbose; match args.command { - Some(Command::Status { rid, sort_by }) => { - let rid = match rid { + Some(Command::Status { repo, sort_by }) => { + let rid = match repo { Some(rid) => rid, None => { let (_, rid) = radicle::rad::cwd() @@ -53,11 +53,11 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> { } None => match SyncMode::from(args.sync) { SyncMode::Repo { - rid, + repo, settings, direction, } => { - let rid = match rid { + let rid = match repo { Some(rid) => rid, None => { let (_, rid) = radicle::rad::cwd() diff --git a/crates/radicle-cli/src/commands/sync/args.rs b/crates/radicle-cli/src/commands/sync/args.rs index 28f7e271..235c9cab 100644 --- a/crates/radicle-cli/src/commands/sync/args.rs +++ b/crates/radicle-cli/src/commands/sync/args.rs @@ -107,7 +107,8 @@ pub(super) struct SyncArgs { timeout: std::time::Duration, /// The repository to perform the synchronizing for [default: cwd] - rid: Option, + #[arg(value_name = "RID")] + repo: Option, /// Synchronize with a specific number of seeds /// @@ -178,7 +179,8 @@ pub(super) enum Command { #[clap(alias = "s")] Status { /// The repository to display the status for [default: cwd] - rid: Option, + #[arg(value_name = "RID")] + repo: Option, /// Sort the table by column #[arg(long, value_name = "FIELD", value_enum, default_value_t)] sort_by: SortBy, @@ -216,7 +218,7 @@ pub(super) enum SyncMode { /// Fetch and/or announce a repositories references Repo { /// The repository being synchronized - rid: Option, + repo: Option, /// The settings for fetch/announce settings: SyncSettings, /// The direction of the synchronization @@ -244,7 +246,7 @@ impl From for SyncMode { settings.seeds = args.seeds.into_iter().collect(); } Self::Repo { - rid: args.rid, + repo: args.repo, settings, direction, }