-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
status: Rework human readable output
- Add a circle like rpm-ostree - Add a whitespace line between entries - Drop not-present entries - Rework timestamp+version combo; if there's no version, then show the column as `Timestamp`; if there's a version but no timestamp, just omit the timestamp - Align columns Closes: #900 Signed-off-by: Colin Walters <[email protected]>
- Loading branch information
Showing
3 changed files
with
139 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//! Special Unicode characters used for display with ASCII fallbacks | ||
//! in case we're not in a UTF-8 locale. | ||
|
||
use std::fmt::Display; | ||
|
||
#[derive(Debug, Copy, Clone, PartialEq, Eq)] | ||
pub(crate) enum Glyph { | ||
BlackCircle, | ||
} | ||
|
||
impl Glyph { | ||
// TODO: Add support for non-Unicode output | ||
#[allow(dead_code)] | ||
pub(crate) fn as_ascii(&self) -> &'static str { | ||
match self { | ||
Glyph::BlackCircle => "*", | ||
} | ||
} | ||
|
||
pub(crate) fn as_utf8(&self) -> &'static str { | ||
match self { | ||
Glyph::BlackCircle => "●", | ||
} | ||
} | ||
} | ||
|
||
impl Display for Glyph { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
f.write_str(self.as_utf8()) | ||
} | ||
} | ||
|
||
#[test] | ||
fn test_glyph() { | ||
assert_eq!(Glyph::BlackCircle.as_utf8(), "●"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,5 @@ pub mod spec; | |
|
||
#[cfg(feature = "docgen")] | ||
mod docgen; | ||
mod glyph; | ||
mod imgstorage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters