Fix for getting glance command list

Usual command uses xxxx --help for getting command list.
but glance case, it need to use help not --help.
For this purpose, adds if branch.
This patch is needed for complete/bash-completion switch.

glance is not viewed "Subcommands" list at header
  glance (Subcommands does not exist)
  http://docs.openstack.org/cli-reference/content/glanceclient_commands.html
  cinder (Subcommands exist)
  http://docs.openstack.org/cli-reference/content/cinderclient_commands.html
For this purpose, add glance switch for "Subcommands".

Change-Id: I33251e5ada49c6e2228d5d08aa5f2c5fd86da8bb
Closes-Bug: #1517756
This commit is contained in:
Atsushi SAKAI 2015-11-19 16:13:54 +09:00
parent 88bb649f57
commit 02b8df904c
1 changed files with 11 additions and 5 deletions

View File

@ -289,6 +289,11 @@ def generate_command(os_command, os_file):
:param os_file: open filehandle for output of DocBook file
"""
if os_command == "glance":
help_lines = subprocess.check_output([os_command, "help"],
universal_newlines=True,
stderr=DEVNULL).split('\n')
else:
help_lines = subprocess.check_output([os_command, "--help"],
universal_newlines=True,
stderr=DEVNULL).split('\n')
@ -312,8 +317,9 @@ def generate_command(os_command, os_file):
next_line_screen = True
os_file.write("</computeroutput></screen>\n")
in_screen = False
format_table('Subcommands', help_lines[line_index + 2:],
os_file)
if os_command != "glance":
format_table('Subcommands',
help_lines[line_index + 2:], os_file)
continue
if line.startswith(('Optional arguments:', 'Optional:',
'Options:', 'optional arguments')):