in service/azservice/__main__.py [0:0]
def get_hover_text(group_index, command_table, command):
subcommand = command['subcommand']
if 'argument' in command and subcommand in command_table:
argument_name = command['argument']
argument = next((argument for argument in get_arguments(command_table[subcommand]).values() if argument_name in get_options(argument.options_list)), None)
if argument:
req = is_required(argument)
return { 'paragraphs': [ '`' + ' '.join(get_options(argument.options_list)) + '`' + ('*' if req else '') + ': ' + argument.type.settings.get('help')
+ ('\n\n*Required' if req else '') ] }
argument = next((argument for argument in GLOBAL_ARGUMENTS.values() if argument_name in argument['options']), None)
if argument:
return { 'paragraphs': [ '`' + ' '.join(argument['options']) + '`: ' + argument['help'] ] }
return
help = get_help(subcommand)
if help:
short_summary = help.get('short-summary')
if short_summary:
paragraphs = [ '{1}\n\n`{0}`\n\n{2}'.format(subcommand, short_summary, help.get('long-summary', '')).strip() ]
if subcommand in command_table:
list = sorted([ argument for argument in get_arguments(command_table[subcommand]).values() if argument.type.settings.get('help') != '==SUPPRESS==' ], key=lambda e: str(not is_required(e)) + get_options(e.options_list)[0])
if list:
paragraphs.append('Arguments\n' + '\n'.join([ '- `' + ' '.join(get_options(argument.options_list)) + '`' + ('*' if is_required(argument) else '') + ': ' + (argument.type.settings.get('help') or '')
for argument in list ]) + ('\n\n*Required' if is_required(list[0]) else ''))
paragraphs.append('Global Arguments\n' + '\n'.join([ '- `' + ' '.join(argument['options']) + '`: ' + argument['help']
for argument in GLOBAL_ARGUMENTS.values() ]))
elif subcommand in group_index:
list = sorted(group_index[subcommand], key=lambda e: e['name'])
groups = [ element for element in list if element['kind'] == 'group' ]
if groups:
paragraphs.append('Subgroups\n' + '\n'.join([ '- `' + element['name'] + '`: ' + get_short_summary(element.get('detail'), '-') for element in groups ]))
commands = [ element for element in list if element['kind'] == 'command' ]
if commands:
paragraphs.append('Commands\n' + '\n'.join([ '- `' + element['name'] + '`: ' + get_short_summary(element.get('detail'), '-') for element in commands ]))
examples = help.get('examples')
if examples:
paragraphs.append('Examples\n\n' + '\n\n'.join([ '{0}\n```azcli\n{1}\n```'.format(example['name'].strip(), example['text'].strip())
for example in examples ]))
return { 'paragraphs': paragraphs }
return