mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-10-18 19:10:30 +08:00
cli/id: Add verbose output to show and list
This commit is contained in:
committed by
Lorenz Leutgeb
parent
c830053e32
commit
ca1b4fa7bc
@@ -241,26 +241,27 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||
identity::State::Redacted(_) => continue,
|
||||
}
|
||||
.into();
|
||||
let id = term::format::oid(r.id).into();
|
||||
let id = if args.verbose {
|
||||
term::label(r.id.to_string())
|
||||
} else {
|
||||
term::format::oid(r.id).into()
|
||||
};
|
||||
let title = term::label(r.title.to_string());
|
||||
let (alias, author) =
|
||||
term::format::Author::new(r.author.public_key(), &profile, true).labels();
|
||||
let timestamp = term::format::timestamp(r.timestamp).into();
|
||||
let parent = r
|
||||
.parent
|
||||
.map(term::format::oid)
|
||||
.unwrap_or_else(|| term::Paint::new("none".to_string()));
|
||||
.map(|p| {
|
||||
if args.verbose {
|
||||
term::label(p.to_string())
|
||||
} else {
|
||||
term::format::oid(p).into()
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|| term::Paint::new("none".to_string()).into());
|
||||
|
||||
revisions.push([
|
||||
icon,
|
||||
id,
|
||||
title,
|
||||
alias,
|
||||
author,
|
||||
state,
|
||||
timestamp,
|
||||
parent.into(),
|
||||
]);
|
||||
revisions.push([icon, id, title, alias, author, state, timestamp, parent]);
|
||||
}
|
||||
revisions.print();
|
||||
|
||||
|
||||
@@ -111,6 +111,11 @@ pub struct Args {
|
||||
#[arg(long, short)]
|
||||
#[arg(global = true)]
|
||||
pub(super) quiet: bool,
|
||||
|
||||
/// Print full OIDs instead of abbreviated ones
|
||||
#[arg(long, short)]
|
||||
#[arg(global = true)]
|
||||
pub(super) verbose: bool,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
|
||||
Reference in New Issue
Block a user