diff --git a/examples/pacman.md b/examples/pacman.md index f75ac172d7f..73ec86fafa1 100644 --- a/examples/pacman.md +++ b/examples/pacman.md @@ -40,9 +40,9 @@ package manager utility Usage: pacman[EXE] Commands: - query -Q --query Query the package database. - sync -S --sync Synchronize packages. - help Print this message or the help of the given subcommand(s) + query, -Q, --query Query the package database. + sync, -S, --sync Synchronize packages. + help Print this message or the help of the given subcommand(s) Options: -h, --help Print help information diff --git a/src/builder/styled_str.rs b/src/builder/styled_str.rs index 61aad469d1d..503bf333747 100644 --- a/src/builder/styled_str.rs +++ b/src/builder/styled_str.rs @@ -219,6 +219,24 @@ impl From<&'_ &'static str> for StyledStr { } } +impl PartialOrd for StyledStr { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for StyledStr { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.iter().map(cmp_key).cmp(other.iter().map(cmp_key)) + } +} + +fn cmp_key(c: (Option