cli: Show a message when there are no issues to display
This commit fixes the inconsistency with the `rad patch` command, which previously displayed an empty table when there were no issues. Now, the CLI will display a message indicating that there are no issues to display. Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
parent
3ea7541d55
commit
8d1bf9e997
|
|
@ -325,6 +325,11 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Operation::List { assigned } => {
|
Operation::List { assigned } => {
|
||||||
|
if issues.is_empty()? {
|
||||||
|
term::print(term::format::italic("Nothing to show."));
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let assignee = match assigned {
|
let assignee = match assigned {
|
||||||
Some(Assigned::Me) => Some(*profile.id()),
|
Some(Assigned::Me) => Some(*profile.id()),
|
||||||
Some(Assigned::Peer(id)) => Some(id.into()),
|
Some(Assigned::Peer(id)) => Some(id.into()),
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,11 @@ where
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return true if the list of issues is empty.
|
||||||
|
pub fn is_empty(&self) -> Result<bool, Error> {
|
||||||
|
Ok(self.count()? == 0)
|
||||||
|
}
|
||||||
|
|
||||||
/// Return objects count.
|
/// Return objects count.
|
||||||
pub fn count(&self) -> Result<usize, Error> {
|
pub fn count(&self) -> Result<usize, Error> {
|
||||||
let raw = cob::list(self.repo, T::type_name())?;
|
let raw = cob::list(self.repo, T::type_name())?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue