cli: Add verbose printing of authors
To allow users to see the full DID of authors of issues, introduce a boolean to the `Author` struct and wire it through. While doing that, also remove `--debug` options from `rad issue` and `rad patch` as they have been obsolete since the introduction of `rad cob [log|show]` for quite some time. See: - https://radicle.zulipchat.com/#narrow/channel/369873-support/topic/help.20with.20seeing.20full.20nid/with/531390047
This commit is contained in:
parent
c8b6a13d64
commit
de78cf7874
|
|
@ -33,14 +33,14 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential s
|
||||||
✓ Target met: 1 seed(s)
|
✓ Target met: 1 seed(s)
|
||||||
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
|
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
|
||||||
$ rad id list
|
$ rad id list
|
||||||
╭─────────────────────────────────────────────────────────────────────────────────╮
|
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||||
│ ● ID Title Author Status Created │
|
│ ● ID Title Author Status Created │
|
||||||
├─────────────────────────────────────────────────────────────────────────────────┤
|
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||||
│ ● 89b2623 Edit project name bob z6Mkt67…v4N1tRk active now │
|
│ ● 89b2623 Edit project name bob z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk active now │
|
||||||
│ ● 12d7300 Edit project name alice (you) active now │
|
│ ● 12d7300 Edit project name alice (you) active now │
|
||||||
│ ● 0ca42d3 Add Bob alice (you) accepted now │
|
│ ● 0ca42d3 Add Bob alice (you) accepted now │
|
||||||
│ ● 0656c21 Initial revision alice (you) accepted now │
|
│ ● 0656c21 Initial revision alice (you) accepted now │
|
||||||
╰─────────────────────────────────────────────────────────────────────────────────╯
|
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||||
```
|
```
|
||||||
|
|
||||||
This isn't a problem as long as we don't try to accept both. So let's accept
|
This isn't a problem as long as we don't try to accept both. So let's accept
|
||||||
|
|
@ -49,14 +49,14 @@ Bob's:
|
||||||
``` ~alice
|
``` ~alice
|
||||||
$ rad id accept 89b2623 -q
|
$ rad id accept 89b2623 -q
|
||||||
$ rad id list
|
$ rad id list
|
||||||
╭─────────────────────────────────────────────────────────────────────────────────╮
|
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||||
│ ● ID Title Author Status Created │
|
│ ● ID Title Author Status Created │
|
||||||
├─────────────────────────────────────────────────────────────────────────────────┤
|
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||||
│ ● 89b2623 Edit project name bob z6Mkt67…v4N1tRk accepted now │
|
│ ● 89b2623 Edit project name bob z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk accepted now │
|
||||||
│ ● 12d7300 Edit project name alice (you) stale now │
|
│ ● 12d7300 Edit project name alice (you) stale now │
|
||||||
│ ● 0ca42d3 Add Bob alice (you) accepted now │
|
│ ● 0ca42d3 Add Bob alice (you) accepted now │
|
||||||
│ ● 0656c21 Initial revision alice (you) accepted now │
|
│ ● 0656c21 Initial revision alice (you) accepted now │
|
||||||
╰─────────────────────────────────────────────────────────────────────────────────╯
|
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||||
```
|
```
|
||||||
|
|
||||||
Doing so voided the other conflicting revision, and it can no longer be
|
Doing so voided the other conflicting revision, and it can no longer be
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential s
|
||||||
✓ Target met: 1 seed(s)
|
✓ Target met: 1 seed(s)
|
||||||
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||||
$ rad id --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
$ rad id --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
╭────────────────────────────────────────────────────────────────────────────────╮
|
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||||
│ ● ID Title Author Status Created │
|
│ ● ID Title Author Status Created │
|
||||||
├────────────────────────────────────────────────────────────────────────────────┤
|
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||||
│ ● 069e7d5 Add Bob alice z6MknSL…StBU8Vi accepted now │
|
│ ● 069e7d5 Add Bob alice z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi accepted now │
|
||||||
│ ● 0656c21 Initial revision alice z6MknSL…StBU8Vi accepted now │
|
│ ● 0656c21 Initial revision alice z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi accepted now │
|
||||||
╰────────────────────────────────────────────────────────────────────────────────╯
|
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||||
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --sigrefs
|
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --sigrefs
|
||||||
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi [..]
|
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi [..]
|
||||||
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk [..]
|
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk [..]
|
||||||
|
|
@ -93,14 +93,14 @@ We can list all revisions:
|
||||||
|
|
||||||
``` ~alice
|
``` ~alice
|
||||||
$ rad id list
|
$ rad id list
|
||||||
╭────────────────────────────────────────────────────────────────────────────────╮
|
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||||
│ ● ID Title Author Status Created │
|
│ ● ID Title Author Status Created │
|
||||||
├────────────────────────────────────────────────────────────────────────────────┤
|
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||||
│ ● e6bf105 Make private alice (you) active now │
|
│ ● e6bf105 Make private alice (you) active now │
|
||||||
│ ● 3cd3c7f Add Eve bob z6Mkt67…v4N1tRk accepted now │
|
│ ● 3cd3c7f Add Eve bob z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk accepted now │
|
||||||
│ ● 069e7d5 Add Bob alice (you) accepted now │
|
│ ● 069e7d5 Add Bob alice (you) accepted now │
|
||||||
│ ● 0656c21 Initial revision alice (you) accepted now │
|
│ ● 0656c21 Initial revision alice (you) accepted now │
|
||||||
╰────────────────────────────────────────────────────────────────────────────────╯
|
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||||
```
|
```
|
||||||
|
|
||||||
Despite being a delegate, Bob can't edit or redact Alice's revision:
|
Despite being a delegate, Bob can't edit or redact Alice's revision:
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ $ rad patch show 6c61ef1 -v
|
||||||
╭─────────────────────────────────────────────────────────────────────╮
|
╭─────────────────────────────────────────────────────────────────────╮
|
||||||
│ Title Define LICENSE for project │
|
│ Title Define LICENSE for project │
|
||||||
│ Patch 6c61ef1716ad8a5c11e04dd7a3fec51e01fba70b │
|
│ Patch 6c61ef1716ad8a5c11e04dd7a3fec51e01fba70b │
|
||||||
│ Author alice z6MknSL…StBU8Vi │
|
│ Author alice z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||||
│ Head 1cc8cd9de8ccc44b4fe3876f2dbd2cd1cf9ddc0e │
|
│ Head 1cc8cd9de8ccc44b4fe3876f2dbd2cd1cf9ddc0e │
|
||||||
│ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │
|
│ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │
|
||||||
│ Commits ahead 2, behind 0 │
|
│ Commits ahead 2, behind 0 │
|
||||||
|
|
|
||||||
|
|
@ -480,7 +480,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let id = term::format::oid(r.id).into();
|
let id = term::format::oid(r.id).into();
|
||||||
let title = term::label(r.title.to_string());
|
let title = term::label(r.title.to_string());
|
||||||
let (alias, author) =
|
let (alias, author) =
|
||||||
term::format::Author::new(r.author.public_key(), &profile).labels();
|
term::format::Author::new(r.author.public_key(), &profile, true).labels();
|
||||||
let timestamp = term::format::timestamp(r.timestamp).into();
|
let timestamp = term::format::timestamp(r.timestamp).into();
|
||||||
|
|
||||||
revisions.push([icon, id, title, alias, author, state, timestamp]);
|
revisions.push([icon, id, title, alias, author, state, timestamp]);
|
||||||
|
|
@ -586,7 +586,7 @@ fn print_meta(revision: &Revision, previous: &Doc, profile: &Profile) -> anyhow:
|
||||||
let mut signatures = term::Table::<4, _>::default();
|
let mut signatures = term::Table::<4, _>::default();
|
||||||
|
|
||||||
for id in accepted {
|
for id in accepted {
|
||||||
let author = term::format::Author::new(&id, profile);
|
let author = term::format::Author::new(&id, profile, true);
|
||||||
signatures.push([
|
signatures.push([
|
||||||
term::PREFIX_SUCCESS.into(),
|
term::PREFIX_SUCCESS.into(),
|
||||||
id.to_string().into(),
|
id.to_string().into(),
|
||||||
|
|
@ -595,7 +595,7 @@ fn print_meta(revision: &Revision, previous: &Doc, profile: &Profile) -> anyhow:
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
for id in rejected {
|
for id in rejected {
|
||||||
let author = term::format::Author::new(&id, profile);
|
let author = term::format::Author::new(&id, profile, true);
|
||||||
signatures.push([
|
signatures.push([
|
||||||
term::PREFIX_ERROR.into(),
|
term::PREFIX_ERROR.into(),
|
||||||
id.to_string().into(),
|
id.to_string().into(),
|
||||||
|
|
@ -604,7 +604,7 @@ fn print_meta(revision: &Revision, previous: &Doc, profile: &Profile) -> anyhow:
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
for id in unknown {
|
for id in unknown {
|
||||||
let author = term::format::Author::new(id, profile);
|
let author = term::format::Author::new(id, profile, true);
|
||||||
signatures.push([
|
signatures.push([
|
||||||
term::format::dim("?").into(),
|
term::format::dim("?").into(),
|
||||||
id.to_string().into(),
|
id.to_string().into(),
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,7 @@ where
|
||||||
let author = n
|
let author = n
|
||||||
.remote
|
.remote
|
||||||
.map(|r| {
|
.map(|r| {
|
||||||
let (alias, _) = term::format::Author::new(&r, profile).labels();
|
let (alias, _) = term::format::Author::new(&r, profile, false).labels();
|
||||||
alias
|
alias
|
||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
@ -542,6 +542,7 @@ fn show(
|
||||||
&issue,
|
&issue,
|
||||||
&typed_id.id,
|
&typed_id.id,
|
||||||
term::issue::Format::default(),
|
term::issue::Format::default(),
|
||||||
|
false,
|
||||||
profile,
|
profile,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ Label options
|
||||||
|
|
||||||
Show options
|
Show options
|
||||||
|
|
||||||
--debug Show the issue as Rust debug output
|
-v, --verbose Show additional information about the issue
|
||||||
|
|
||||||
Options
|
Options
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ pub enum Operation {
|
||||||
Show {
|
Show {
|
||||||
id: Rev,
|
id: Rev,
|
||||||
format: Format,
|
format: Format,
|
||||||
debug: bool,
|
verbose: bool,
|
||||||
},
|
},
|
||||||
CommentEdit {
|
CommentEdit {
|
||||||
id: Rev,
|
id: Rev,
|
||||||
|
|
@ -202,7 +202,7 @@ impl Args for Options {
|
||||||
let mut edit_comment = None;
|
let mut edit_comment = None;
|
||||||
let mut announce = true;
|
let mut announce = true;
|
||||||
let mut quiet = false;
|
let mut quiet = false;
|
||||||
let mut debug = false;
|
let mut verbose = false;
|
||||||
let mut assign_opts = AssignOptions::default();
|
let mut assign_opts = AssignOptions::default();
|
||||||
let mut label_opts = LabelOptions::default();
|
let mut label_opts = LabelOptions::default();
|
||||||
let mut repo = None;
|
let mut repo = None;
|
||||||
|
|
@ -295,8 +295,8 @@ impl Args for Options {
|
||||||
_ => anyhow::bail!("unknown format '{val}'"),
|
_ => anyhow::bail!("unknown format '{val}'"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Long("debug") if op == Some(OperationName::Show) => {
|
Long("verbose") | Short('v') if op == Some(OperationName::Show) => {
|
||||||
debug = true;
|
verbose = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comment options.
|
// Comment options.
|
||||||
|
|
@ -430,7 +430,7 @@ impl Args for Options {
|
||||||
OperationName::Show => Operation::Show {
|
OperationName::Show => Operation::Show {
|
||||||
id: id.ok_or_else(|| anyhow!("an issue must be provided"))?,
|
id: id.ok_or_else(|| anyhow!("an issue must be provided"))?,
|
||||||
format,
|
format,
|
||||||
debug,
|
verbose,
|
||||||
},
|
},
|
||||||
OperationName::State => Operation::State {
|
OperationName::State => Operation::State {
|
||||||
id: id.ok_or_else(|| anyhow!("an issue must be provided"))?,
|
id: id.ok_or_else(|| anyhow!("an issue must be provided"))?,
|
||||||
|
|
@ -502,7 +502,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let signer = term::signer(&profile)?;
|
let signer = term::signer(&profile)?;
|
||||||
let issue = edit(&mut issues, &repo, id, title, description, &signer)?;
|
let issue = edit(&mut issues, &repo, id, title, description, &signer)?;
|
||||||
if !options.quiet {
|
if !options.quiet {
|
||||||
term::issue::show(&issue, issue.id(), Format::Header, &profile)?;
|
term::issue::show(&issue, issue.id(), Format::Header, false, &profile)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Operation::Open {
|
Operation::Open {
|
||||||
|
|
@ -514,7 +514,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let signer = term::signer(&profile)?;
|
let signer = term::signer(&profile)?;
|
||||||
let issue = issues.create(title, description, &labels, &assignees, [], &signer)?;
|
let issue = issues.create(title, description, &labels, &assignees, [], &signer)?;
|
||||||
if !options.quiet {
|
if !options.quiet {
|
||||||
term::issue::show(&issue, issue.id(), Format::Header, &profile)?;
|
term::issue::show(&issue, issue.id(), Format::Header, false, &profile)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Operation::Comment {
|
Operation::Comment {
|
||||||
|
|
@ -572,7 +572,11 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
term::comment::widget(&comment_id, comment, &profile).print();
|
term::comment::widget(&comment_id, comment, &profile).print();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Operation::Show { id, format, debug } => {
|
Operation::Show {
|
||||||
|
id,
|
||||||
|
format,
|
||||||
|
verbose,
|
||||||
|
} => {
|
||||||
let id = id.resolve(&repo.backend)?;
|
let id = id.resolve(&repo.backend)?;
|
||||||
let issue = issues
|
let issue = issues
|
||||||
.get(&id)
|
.get(&id)
|
||||||
|
|
@ -581,11 +585,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
hint: "reset the cache with `rad issue cache` and try again",
|
hint: "reset the cache with `rad issue cache` and try again",
|
||||||
})?
|
})?
|
||||||
.context("No issue with the given ID exists")?;
|
.context("No issue with the given ID exists")?;
|
||||||
if debug {
|
term::issue::show(&issue, &id, format, verbose, &profile)?;
|
||||||
println!("{issue:#?}");
|
|
||||||
} else {
|
|
||||||
term::issue::show(&issue, &id, format, &profile)?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Operation::State { id, state } => {
|
Operation::State { id, state } => {
|
||||||
let signer = term::signer(&profile)?;
|
let signer = term::signer(&profile)?;
|
||||||
|
|
@ -783,7 +783,7 @@ where
|
||||||
let assigned: String = issue
|
let assigned: String = issue
|
||||||
.assignees()
|
.assignees()
|
||||||
.map(|did| {
|
.map(|did| {
|
||||||
let (alias, _) = Author::new(did.as_key(), profile).labels();
|
let (alias, _) = Author::new(did.as_key(), profile, false).labels();
|
||||||
|
|
||||||
alias.content().to_owned()
|
alias.content().to_owned()
|
||||||
})
|
})
|
||||||
|
|
@ -794,7 +794,7 @@ where
|
||||||
labels.sort();
|
labels.sort();
|
||||||
|
|
||||||
let author = issue.author().id;
|
let author = issue.author().id;
|
||||||
let (alias, did) = Author::new(&author, profile).labels();
|
let (alias, did) = Author::new(&author, profile, false).labels();
|
||||||
|
|
||||||
table.push([
|
table.push([
|
||||||
match issue.state() {
|
match issue.state() {
|
||||||
|
|
@ -855,7 +855,7 @@ where
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if !options.quiet {
|
if !options.quiet {
|
||||||
term::issue::show(&issue, issue.id(), Format::Header, profile)?;
|
term::issue::show(&issue, issue.id(), Format::Header, false, profile)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ Show options
|
||||||
|
|
||||||
-p, --patch Show the actual patch diff
|
-p, --patch Show the actual patch diff
|
||||||
-v, --verbose Show additional information about the patch
|
-v, --verbose Show additional information about the patch
|
||||||
--debug Show the patch as Rust debug output
|
|
||||||
|
|
||||||
Diff options
|
Diff options
|
||||||
|
|
||||||
|
|
@ -231,7 +230,7 @@ pub enum Operation {
|
||||||
Show {
|
Show {
|
||||||
patch_id: Rev,
|
patch_id: Rev,
|
||||||
diff: bool,
|
diff: bool,
|
||||||
debug: bool,
|
verbose: bool,
|
||||||
},
|
},
|
||||||
Diff {
|
Diff {
|
||||||
patch_id: Rev,
|
patch_id: Rev,
|
||||||
|
|
@ -356,7 +355,6 @@ pub struct Options {
|
||||||
pub op: Operation,
|
pub op: Operation,
|
||||||
pub repo: Option<RepoId>,
|
pub repo: Option<RepoId>,
|
||||||
pub announce: bool,
|
pub announce: bool,
|
||||||
pub verbose: bool,
|
|
||||||
pub quiet: bool,
|
pub quiet: bool,
|
||||||
pub authored: bool,
|
pub authored: bool,
|
||||||
pub authors: Vec<Did>,
|
pub authors: Vec<Did>,
|
||||||
|
|
@ -380,7 +378,6 @@ impl Args for Options {
|
||||||
let mut message = Message::default();
|
let mut message = Message::default();
|
||||||
let mut filter = Some(patch::Status::Open);
|
let mut filter = Some(patch::Status::Open);
|
||||||
let mut diff = false;
|
let mut diff = false;
|
||||||
let mut debug = false;
|
|
||||||
let mut undo = false;
|
let mut undo = false;
|
||||||
let mut reaction: Option<Reaction> = None;
|
let mut reaction: Option<Reaction> = None;
|
||||||
let mut reply_to: Option<Rev> = None;
|
let mut reply_to: Option<Rev> = None;
|
||||||
|
|
@ -418,8 +415,8 @@ impl Args for Options {
|
||||||
Long("patch") | Short('p') if op == Some(OperationName::Show) => {
|
Long("patch") | Short('p') if op == Some(OperationName::Show) => {
|
||||||
diff = true;
|
diff = true;
|
||||||
}
|
}
|
||||||
Long("debug") if op == Some(OperationName::Show) => {
|
Long("verbose") | Short('v') if op == Some(OperationName::Show) => {
|
||||||
debug = true;
|
verbose = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ready options.
|
// Ready options.
|
||||||
|
|
@ -666,9 +663,6 @@ impl Args for Options {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common.
|
// Common.
|
||||||
Long("verbose") | Short('v') => {
|
|
||||||
verbose = true;
|
|
||||||
}
|
|
||||||
Long("quiet") | Short('q') => {
|
Long("quiet") | Short('q') => {
|
||||||
quiet = true;
|
quiet = true;
|
||||||
}
|
}
|
||||||
|
|
@ -742,7 +736,7 @@ impl Args for Options {
|
||||||
OperationName::Show => Operation::Show {
|
OperationName::Show => Operation::Show {
|
||||||
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
||||||
diff,
|
diff,
|
||||||
debug,
|
verbose,
|
||||||
},
|
},
|
||||||
OperationName::Diff => Operation::Diff {
|
OperationName::Diff => Operation::Diff {
|
||||||
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
||||||
|
|
@ -848,7 +842,6 @@ impl Args for Options {
|
||||||
Options {
|
Options {
|
||||||
op,
|
op,
|
||||||
repo,
|
repo,
|
||||||
verbose,
|
|
||||||
quiet,
|
quiet,
|
||||||
announce,
|
announce,
|
||||||
authored,
|
authored,
|
||||||
|
|
@ -885,14 +878,13 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
Operation::Show {
|
Operation::Show {
|
||||||
patch_id,
|
patch_id,
|
||||||
diff,
|
diff,
|
||||||
debug,
|
verbose,
|
||||||
} => {
|
} => {
|
||||||
let patch_id = patch_id.resolve(&repository.backend)?;
|
let patch_id = patch_id.resolve(&repository.backend)?;
|
||||||
show::run(
|
show::run(
|
||||||
&patch_id,
|
&patch_id,
|
||||||
diff,
|
diff,
|
||||||
debug,
|
verbose,
|
||||||
options.verbose,
|
|
||||||
&profile,
|
&profile,
|
||||||
&repository,
|
&repository,
|
||||||
workdir.as_ref(),
|
workdir.as_ref(),
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ pub fn row(
|
||||||
let (from, to) = revision.range();
|
let (from, to) = revision.range();
|
||||||
let stats = common::diff_stats(repository.raw(), &from, &to)?;
|
let stats = common::diff_stats(repository.raw(), &from, &to)?;
|
||||||
let author = patch.author().id;
|
let author = patch.author().id;
|
||||||
let (alias, did) = Author::new(&author, profile).labels();
|
let (alias, did) = Author::new(&author, profile, false).labels();
|
||||||
let mut delegates = repository
|
let mut delegates = repository
|
||||||
.delegates()?
|
.delegates()?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ fn show_patch_diff(patch: &patch::Patch, stored: &Repository) -> anyhow::Result<
|
||||||
pub fn run(
|
pub fn run(
|
||||||
patch_id: &PatchId,
|
patch_id: &PatchId,
|
||||||
diff: bool,
|
diff: bool,
|
||||||
debug: bool,
|
|
||||||
verbose: bool,
|
verbose: bool,
|
||||||
profile: &Profile,
|
profile: &Profile,
|
||||||
stored: &Repository,
|
stored: &Repository,
|
||||||
|
|
@ -41,10 +40,6 @@ pub fn run(
|
||||||
anyhow::bail!("Patch `{patch_id}` not found");
|
anyhow::bail!("Patch `{patch_id}` not found");
|
||||||
};
|
};
|
||||||
|
|
||||||
if debug {
|
|
||||||
println!("{patch:#?}");
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
term::patch::show(&patch, patch_id, verbose, stored, workdir, profile)?;
|
term::patch::show(&patch, patch_id, verbose, stored, workdir, profile)?;
|
||||||
|
|
||||||
if diff {
|
if diff {
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,8 @@ fn sync_status(
|
||||||
),
|
),
|
||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
let (alias, nid) = Author::new(&seed.nid, profile).labels();
|
|
||||||
|
let (alias, nid) = Author::new(&seed.nid, profile, options.verbose).labels();
|
||||||
|
|
||||||
table.push([
|
table.push([
|
||||||
nid,
|
nid,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ pub fn header<T>(
|
||||||
profile: &Profile,
|
profile: &Profile,
|
||||||
) -> term::hstack::HStack<'static> {
|
) -> term::hstack::HStack<'static> {
|
||||||
let author = comment.author();
|
let author = comment.author();
|
||||||
let author = Author::new(&author, profile);
|
let author = Author::new(&author, profile, false);
|
||||||
let (alias, nid) = author.labels();
|
let (alias, nid) = author.labels();
|
||||||
|
|
||||||
term::hstack::HStack::default()
|
term::hstack::HStack::default()
|
||||||
|
|
|
||||||
|
|
@ -223,16 +223,18 @@ pub struct Author<'a> {
|
||||||
nid: &'a NodeId,
|
nid: &'a NodeId,
|
||||||
alias: Option<Alias>,
|
alias: Option<Alias>,
|
||||||
you: bool,
|
you: bool,
|
||||||
|
verbose: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Author<'a> {
|
impl<'a> Author<'a> {
|
||||||
pub fn new(nid: &'a NodeId, profile: &Profile) -> Author<'a> {
|
pub fn new(nid: &'a NodeId, profile: &Profile, verbose: bool) -> Author<'a> {
|
||||||
let alias = profile.alias(nid);
|
let alias = profile.alias(nid);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
nid,
|
nid,
|
||||||
alias,
|
alias,
|
||||||
you: nid == profile.id(),
|
you: nid == profile.id(),
|
||||||
|
verbose,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,20 +257,20 @@ impl<'a> Author<'a> {
|
||||||
/// * `(<alias>, <did>)` -- the `Author` is another peer and has an alias
|
/// * `(<alias>, <did>)` -- the `Author` is another peer and has an alias
|
||||||
/// * `(<blank>, <did>)` -- the `Author` is another peer and has no alias
|
/// * `(<blank>, <did>)` -- the `Author` is another peer and has no alias
|
||||||
pub fn labels(self) -> (term::Label, term::Label) {
|
pub fn labels(self) -> (term::Label, term::Label) {
|
||||||
|
let node_id = if self.verbose {
|
||||||
|
term::format::node_id_human(self.nid)
|
||||||
|
} else {
|
||||||
|
term::format::node_id_human_compact(self.nid)
|
||||||
|
};
|
||||||
|
|
||||||
let alias = match self.alias.as_ref() {
|
let alias = match self.alias.as_ref() {
|
||||||
Some(alias) => term::format::primary(alias).into(),
|
Some(alias) => term::format::primary(alias).into(),
|
||||||
None if self.you => {
|
None if self.you => term::format::primary(node_id.clone()).dim().into(),
|
||||||
term::format::primary(term::format::node_id_human_compact(self.nid))
|
|
||||||
.dim()
|
|
||||||
.into()
|
|
||||||
}
|
|
||||||
None => term::Label::blank(),
|
None => term::Label::blank(),
|
||||||
};
|
};
|
||||||
let author = self.you().unwrap_or_else(|| {
|
let author = self
|
||||||
term::format::primary(term::format::node_id_human_compact(self.nid))
|
.you()
|
||||||
.dim()
|
.unwrap_or_else(move || term::format::primary(node_id).dim().into());
|
||||||
.into()
|
|
||||||
});
|
|
||||||
(alias, author)
|
(alias, author)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ pub fn show(
|
||||||
issue: &issue::Issue,
|
issue: &issue::Issue,
|
||||||
id: &cob::ObjectId,
|
id: &cob::ObjectId,
|
||||||
format: Format,
|
format: Format,
|
||||||
|
verbose: bool,
|
||||||
profile: &Profile,
|
profile: &Profile,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let labels: Vec<String> = issue.labels().cloned().map(|t| t.into()).collect();
|
let labels: Vec<String> = issue.labels().cloned().map(|t| t.into()).collect();
|
||||||
|
|
@ -51,7 +52,7 @@ pub fn show(
|
||||||
.collect();
|
.collect();
|
||||||
let author = issue.author();
|
let author = issue.author();
|
||||||
let did = author.id();
|
let did = author.id();
|
||||||
let author = Author::new(did, profile);
|
let author = Author::new(did, profile, verbose);
|
||||||
|
|
||||||
let mut attrs = Table::<2, term::Line>::new(TableOptions {
|
let mut attrs = Table::<2, term::Line>::new(TableOptions {
|
||||||
spacing: 2,
|
spacing: 2,
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,7 @@ pub fn show(
|
||||||
*patch.target().head(stored)?,
|
*patch.target().head(stored)?,
|
||||||
)?;
|
)?;
|
||||||
let author = patch.author();
|
let author = patch.author();
|
||||||
let author = term::format::Author::new(author.id(), profile);
|
let author = term::format::Author::new(author.id(), profile, verbose);
|
||||||
let labels = patch.labels().map(|l| l.to_string()).collect::<Vec<_>>();
|
let labels = patch.labels().map(|l| l.to_string()).collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut attrs = term::Table::<2, term::Line>::new(term::TableOptions {
|
let mut attrs = term::Table::<2, term::Line>::new(term::TableOptions {
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ impl<'a> Opened<'a> {
|
||||||
Some((
|
Some((
|
||||||
merge.timestamp,
|
merge.timestamp,
|
||||||
Update::Merged {
|
Update::Merged {
|
||||||
author: Author::new(nid, profile),
|
author: Author::new(nid, profile, false),
|
||||||
merge: merge.clone(),
|
merge: merge.clone(),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
@ -96,7 +96,7 @@ impl<'a> Opened<'a> {
|
||||||
}));
|
}));
|
||||||
updates.sort_by_key(|(t, _)| *t);
|
updates.sort_by_key(|(t, _)| *t);
|
||||||
Opened {
|
Opened {
|
||||||
author: Author::new(&patch.author().id, profile),
|
author: Author::new(&patch.author().id, profile, false),
|
||||||
timestamp: patch.timestamp(),
|
timestamp: patch.timestamp(),
|
||||||
head: revision.head(),
|
head: revision.head(),
|
||||||
updates: updates.into_iter().map(|(_, up)| up).collect(),
|
updates: updates.into_iter().map(|(_, up)| up).collect(),
|
||||||
|
|
@ -176,7 +176,7 @@ impl<'a> RevisionEntry<'a> {
|
||||||
Some((
|
Some((
|
||||||
merge.timestamp,
|
merge.timestamp,
|
||||||
Update::Merged {
|
Update::Merged {
|
||||||
author: Author::new(nid, profile),
|
author: Author::new(nid, profile, false),
|
||||||
merge: merge.clone(),
|
merge: merge.clone(),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
@ -195,7 +195,7 @@ impl<'a> RevisionEntry<'a> {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RevisionEntry::Revised {
|
RevisionEntry::Revised {
|
||||||
author: Author::new(&revision.author().id, profile),
|
author: Author::new(&revision.author().id, profile, false),
|
||||||
timestamp: revision.timestamp(),
|
timestamp: revision.timestamp(),
|
||||||
id,
|
id,
|
||||||
head: revision.head(),
|
head: revision.head(),
|
||||||
|
|
@ -305,7 +305,7 @@ impl Update<'_> {
|
||||||
term::format::default("by").into(),
|
term::format::default("by").into(),
|
||||||
])
|
])
|
||||||
.space()
|
.space()
|
||||||
.extend(Author::new(&review.author().id.into(), profile).line())
|
.extend(Author::new(&review.author().id.into(), profile, false).line())
|
||||||
}
|
}
|
||||||
Update::Merged { author, merge } => {
|
Update::Merged { author, merge } => {
|
||||||
let (alias, nid) = author.labels();
|
let (alias, nid) = author.labels();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue