Skip to content

Commit c734864

Browse files
authored
Merge pull request #82 from glotzerlab/report-no-matches
Report "No matches."
2 parents 277898a + 0e015d3 commit c734864

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
- aarch64-apple-darwin
9999
include:
100100
- target: x86_64-unknown-linux-gnu
101-
runner: ubuntu-20.04
101+
runner: ubuntu-22.04
102102
- target: aarch64-apple-darwin
103103
runner: macos-14
104104

doc/src/release-notes.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Release notes
22

3+
## 0.5.0 (not yet released)
4+
5+
*Highlights:*
6+
7+
**Row** 0.5 improves the user interface and updates the code to meet modern
8+
Rust standards.
9+
10+
The subcommands `show directories`, `show jobs`, and `show status` now report
11+
`No matches.` when there are no results to show.
12+
13+
*Changed:*
14+
15+
* Writing tabular output with no rows now results in the output `No matches.`.
16+
* Build executables on Ubuntu 22.04.
17+
318
## 0.4.0 (2024-12-06)
419

520
*Highlights:*

src/ui.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,29 @@ impl<T: Write> Drop for MultiProgressWriter<T> {
7070
}
7171
}
7272

73+
#[derive(Clone, Debug, PartialEq)]
7374
pub(crate) enum Alignment {
7475
Left,
7576
Right,
7677
}
7778

7879
/// One item in a table.
80+
#[derive(Clone, Debug, PartialEq)]
7981
pub(crate) struct Item {
8082
text: String,
8183
style: Style,
8284
alignment: Alignment,
8385
}
8486

8587
/// A table row is either a separator or a vector of items.
88+
#[derive(Clone, Debug, PartialEq)]
8689
pub(crate) enum Row {
8790
Separator,
8891
Items(Vec<Item>),
8992
}
9093

9194
/// The table
95+
#[derive(Clone, Debug, PartialEq)]
9296
pub(crate) struct Table {
9397
// The header row.
9498
pub header: Vec<Item>,
@@ -154,6 +158,11 @@ impl Table {
154158
}
155159

156160
pub(crate) fn write<W: Write>(&self, writer: &mut W) -> io::Result<()> {
161+
if self.rows.is_empty() || self.rows.len() == 1 && self.rows[0] == Row::Separator {
162+
writeln!(writer, "No matches.")?;
163+
return Ok(());
164+
}
165+
157166
let mut column_width: Vec<usize> = self
158167
.header
159168
.iter()

0 commit comments

Comments
 (0)