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`.
This commit is contained in:
Lorenz Leutgeb
2026-04-17 17:09:15 +01:00
committed by Fintan Halpenny
parent 07c624499c
commit f2e96c96ce
8 changed files with 18 additions and 16 deletions
+1 -1
View File
@@ -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")?;
+1 -1
View File
@@ -19,7 +19,7 @@ pub struct Args {
///
/// [example values: rad:z3Tr6bC7ctEg2EHmLvknUr29mEDLH, z3Tr6bC7ctEg2EHmLvknUr29mEDLH]
#[arg(value_name = "RID")]
pub(super) rid: Option<RepoId>,
pub(super) repo: Option<RepoId>,
}
#[cfg(test)]
+2 -2
View File
@@ -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 {
+2 -2
View File
@@ -147,8 +147,8 @@ pub(super) enum Command {
json: bool,
/// Show the routing table entries for the given RID
#[arg(long)]
rid: Option<RepoId>,
#[arg(long = "rid", value_name = "RID")]
repo: Option<RepoId>,
/// Show the routing table entries for the given NID
#[arg(long)]
+1 -1
View File
@@ -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)
@@ -21,7 +21,7 @@ pub struct Args {
///
/// [example values: rad:z3Tr6bC7ctEg2EHmLvknUr29mEDLH, z3Tr6bC7ctEg2EHmLvknUr29mEDLH]
#[arg(value_name = "RID")]
pub(super) rid: Option<RepoId>,
pub(super) repo: Option<RepoId>,
}
#[cfg(test)]
+4 -4
View File
@@ -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()
+6 -4
View File
@@ -107,7 +107,8 @@ pub(super) struct SyncArgs {
timeout: std::time::Duration,
/// The repository to perform the synchronizing for [default: cwd]
rid: Option<RepoId>,
#[arg(value_name = "RID")]
repo: Option<RepoId>,
/// 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<RepoId>,
#[arg(value_name = "RID")]
repo: Option<RepoId>,
/// 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<RepoId>,
repo: Option<RepoId>,
/// The settings for fetch/announce
settings: SyncSettings,
/// The direction of the synchronization
@@ -244,7 +246,7 @@ impl From<SyncArgs> for SyncMode {
settings.seeds = args.seeds.into_iter().collect();
}
Self::Repo {
rid: args.rid,
repo: args.repo,
settings,
direction,
}