Browse Source

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
changes/29/247329/3
Atsushi SAKAI 6 years ago
parent
commit
02b8df904c
  1. 16
      os_doc_tools/commands.py

16
os_doc_tools/commands.py

@ -289,9 +289,14 @@ def generate_command(os_command, os_file):
:param os_file: open filehandle for output of DocBook file
"""
help_lines = subprocess.check_output([os_command, "--help"],
universal_newlines=True,
stderr=DEVNULL).split('\n')
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')
ignore_next_lines = False
next_line_screen = True
@ -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')):

Loading…
Cancel
Save