summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-02-10 21:21:57 +0100
committerGitHub <noreply@github.com>2018-02-10 21:21:57 +0100
commit7bbc379b73d93e48eee02534a81acb454d62de71 (patch)
treeb38845302a3955223a773cea6aa3fe44d9b3cd1f
parentfaafe6e994eee23f9b42d81bb33d3cb4985430f9 (diff)
parent45cec64575dd13d8961a86363e5353f483a987a3 (diff)
downloadimag-7bbc379b73d93e48eee02534a81acb454d62de71.zip
imag-7bbc379b73d93e48eee02534a81acb454d62de71.tar.gz
Merge pull request #1266 from matthiasbeyer/imag/list-commands-alphabetically
Sort commands alphabetically
-rw-r--r--bin/core/imag/src/main.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/core/imag/src/main.rs b/bin/core/imag/src/main.rs
index 8bc6cef..19f5308 100644
--- a/bin/core/imag/src/main.rs
+++ b/bin/core/imag/src/main.rs
@@ -86,10 +86,10 @@ fn help_text(cmds: Vec<String>) -> String {
/// Returns the list of imag-* executables found in $PATH
fn get_commands() -> Vec<String> {
- match env::var("PATH") {
+ let mut v = match env::var("PATH") {
Err(e) => {
println!("PATH error: {:?}", e);
- exit(1);
+ exit(1)
},
Ok(path) => path
@@ -109,8 +109,11 @@ fn get_commands() -> Vec<String> {
.and_then(|s| s.splitn(2, "-").nth(1).map(String::from))
)
})
- .collect()
- }
+ .collect::<Vec<String>>()
+ };
+
+ v.sort();
+ v
}