Permalink
Browse files

add single '-' prefix for length 1 aliases and flags to help output

  • Loading branch information...
minrk committed Aug 4, 2011
1 parent d93e6e5 commit 8698e5eb9c76f43344c4e1b660ebe45b9484f223
Showing with 4 additions and 1 deletion.
  1. +4 −1 IPython/config/application.py
@@ -210,6 +210,8 @@ def print_alias_help(self):
help = cls.class_get_trait_help(trait).splitlines()
# reformat first line
help[0] = help[0].replace(longname, alias) + ' (%s)'%longname
+ if len(alias) == 1:
+ help[0] = help[0].replace('--%s='%alias, '-%s '%alias)
lines.extend(help)
# lines.append('')
print os.linesep.join(lines)
@@ -221,7 +223,8 @@ def print_flag_help(self):
lines = []
for m, (cfg,help) in self.flags.iteritems():
- lines.append('--'+m)
+ prefix = '--' if len(m) > 1 else '-'
+ lines.append(prefix+m)
lines.append(indent(dedent(help.strip())))
# lines.append('')
print os.linesep.join(lines)

0 comments on commit 8698e5e

Please sign in to comment.