Merge "Add bash-completion/complete selection for command list parsing"

This commit is contained in:
Jenkins 2015-11-15 11:03:41 +00:00 committed by Gerrit Code Review
commit c8a4549621
1 changed files with 6 additions and 2 deletions

View File

@ -298,6 +298,7 @@ def generate_command(os_command, os_file):
next_line_screen = True next_line_screen = True
line_index = -1 line_index = -1
in_screen = False in_screen = False
subcommands = 'complete'
for line in help_lines: for line in help_lines:
line_index += 1 line_index += 1
xline = quote_xml(line) xline = quote_xml(line)
@ -383,11 +384,15 @@ def generate_command(os_command, os_file):
in_screen = True in_screen = True
elif line: elif line:
os_file.write("\n%s" % xline.rstrip()) os_file.write("\n%s" % xline.rstrip())
# subcommands (select bash-completion, complete for bash-completion)
if 'bash-completion' in line:
subcommands = 'bash-completion'
if in_screen: if in_screen:
os_file.write("</computeroutput></screen>\n") os_file.write("</computeroutput></screen>\n")
os_file.write(" </section>\n") os_file.write(" </section>\n")
return subcommands
def generate_subcommand(os_command, os_subcommand, os_file, extra_params, def generate_subcommand(os_command, os_subcommand, os_file, extra_params,
@ -616,12 +621,11 @@ def document_single_project(os_command, output_dir):
else: else:
api_name = '' api_name = ''
title = data.get('title', '') title = data.get('title', '')
subcommands = data.get('subcommands', 'bash-completion')
out_filename = "ch_cli_" + os_command + "_commands.xml" out_filename = "ch_cli_" + os_command + "_commands.xml"
out_file = open(os.path.join(output_dir, out_filename), 'w') out_file = open(os.path.join(output_dir, out_filename), 'w')
generate_heading(os_command, api_name, title, out_file) generate_heading(os_command, api_name, title, out_file)
generate_command(os_command, out_file) subcommands = generate_command(os_command, out_file)
if os_command == 'cinder': if os_command == 'cinder':
out_file.write(""" out_file.write("""