Skip to content

Commit

Permalink
scenario polish
Browse files Browse the repository at this point in the history
  • Loading branch information
BurtBiel committed Mar 22, 2016
1 parent 00c7a73 commit fafda81
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/azure/cli/_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,13 @@ def _display_usage(self, noun_map, out=sys.stdout):

if isinstance(doc, GroupHelpFile):
for child in doc.children:
args = delimiters.split('.')
args = delimiters.split('.') if delimiters != 'azure-cli' else []
args.append(child.name)
child.command = ' '.join(args)
child.delimiters = '.'.join(args)
it = self._get_args_itr(args)
m, _ = self._get_noun_map(args, it, out)

child.load(m)

print_detailed_help(doc, out)
Expand All @@ -371,6 +374,12 @@ def _display_completions(self, noun_map, arguments, out=sys.stdout):
def _display_children(self, noun_map, arguments, out=sys.stdout):
nouns = self._get_noun_matches(arguments, noun_map, out)

group_help = HelpFile(noun_map['$full_name'])
group_help.load(noun_map)
print(L('Group'), file=out)
print_description_list([group_help], out)
print(L('\nSub-Commands'), file=out)

help_files = []
for noun in sorted(nouns):
args = '{0} {1}'.format(' '.join(arguments), noun).split(' ') \
Expand Down
5 changes: 2 additions & 3 deletions src/azure/cli/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ def _print_header(help_file):

indent = 1
if help_file.long_summary:
_print_indent('{0}'.format(help_file.long_summary), indent)
else:
_print_indent('')
_print_indent('{0}'.format(help_file.long_summary.rstrip()), indent)
_print_indent('')

def _print_groups(help_file):
indent = 1
Expand Down
2 changes: 1 addition & 1 deletion src/azure/cli/tests/test_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def fn(a, b):
io = StringIO()
cmd_result = p.execute('group1'.split(), out=io)
self.assertIsNone(cmd_result.result)
s = ' group2\n group3\n'
s = 'Group\n group1\n\nSub-Commands\n group2\n group3\n'
self.assertEqual(s, io.getvalue())
io.close()

Expand Down

0 comments on commit fafda81

Please sign in to comment.