Merge pull request #1266 from matthiasbeyer/imag/list-commands-alphabetically

Sort commands alphabetically
This commit is contained in:
Matthias Beyer 2018-02-10 21:21:57 +01:00 committed by GitHub
commit 7bbc379b73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,10 +86,10 @@ fn help_text(cmds: Vec<String>) -> String {
/// Returns the list of imag-* executables found in $PATH /// Returns the list of imag-* executables found in $PATH
fn get_commands() -> Vec<String> { fn get_commands() -> Vec<String> {
match env::var("PATH") { let mut v = match env::var("PATH") {
Err(e) => { Err(e) => {
println!("PATH error: {:?}", e); println!("PATH error: {:?}", e);
exit(1); exit(1)
}, },
Ok(path) => path Ok(path) => path
@ -109,8 +109,11 @@ fn get_commands() -> Vec<String> {
.and_then(|s| s.splitn(2, "-").nth(1).map(String::from)) .and_then(|s| s.splitn(2, "-").nth(1).map(String::from))
) )
}) })
.collect() .collect::<Vec<String>>()
} };
v.sort();
v
} }