Fixes trove help command

Reason:
- trove help output misplaces the position of "<subcommand> ..."
  from bottom to top.
- This behavior is because of formatting done to
  Print positionals before optionals.

Changes:
- Sequence fixed in trove help output.

Change-Id: I8aff2eec9f915a7ec1960b67ee7ba8423624aad6
Closes-Bug: #1260332
This commit is contained in:
Sushil Kumar
2013-12-12 14:07:01 +00:00
parent e728b04379
commit 2c509b7fa1

View File

@@ -614,7 +614,14 @@ class OpenStackHelpFormatter(argparse.HelpFormatter):
if len(prefix) + len(prog) <= 0.75 * text_width:
indent = ' ' * (len(prefix) + len(prog) + 1)
if pos_parts:
lines = get_lines([prog] + pos_parts, indent, prefix)
if prog == 'trove':
# "trove help" called without any subcommand
lines = get_lines([prog] + opt_parts, indent,
prefix)
lines.extend(get_lines(pos_parts, indent))
else:
lines = get_lines([prog] + pos_parts, indent,
prefix)
lines.extend(get_lines(opt_parts, indent))
elif opt_parts:
lines = get_lines([prog] + opt_parts, indent, prefix)