From 50b47445ad5a1382546e593073e2acdf9d73300c Mon Sep 17 00:00:00 2001 From: Chris Lane Date: Fri, 9 Aug 2013 22:24:12 -0400 Subject: [PATCH] On help, the 'Available keyphrases' output is now alphabetized. --- cheat | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cheat b/cheat index 8bcb762..217320b 100755 --- a/cheat +++ b/cheat @@ -110,15 +110,14 @@ tar -cjvf /path/to/foo.tgz /path/to/foo/ } # print help if requested -# @todo: alphabetize key names if possible if keyphrase in ['', 'help', '--help', '-h']: - print 'Usage: cheat [keyphrase]' - print 'Available keyphrases:' - for key in cheatsheets: - print key + cheatsheets_sorted = cheatsheets.keys() + cheatsheets_sorted.sort() + + print "Usage: cheat [keyphrase]\n" + print "Available keyphrases:" + print "\n".join(cheatsheets_sorted) exit() # print the cheatsheet if it exists -# @todo: if I could get tab-completion on the cheatsheet names, that would -# be awesome print cheatsheets[keyphrase] if keyphrase in cheatsheets.keys() else 'No cheatsheet found.'