From c73092d3989d7acb0548041671a8766ea5bf79d6 Mon Sep 17 00:00:00 2001 From: KATO Tomoyuki Date: Fri, 10 Feb 2017 20:55:20 +0900 Subject: [PATCH] [cli-ref] support required arguments option Change-Id: I7a2f198846a279f2191bdf17e53b582e07e000cd Partial-Bug: #1643540 --- os_doc_tools/commands.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/os_doc_tools/commands.py b/os_doc_tools/commands.py index 51381297..93e9c6fc 100644 --- a/os_doc_tools/commands.py +++ b/os_doc_tools/commands.py @@ -497,9 +497,10 @@ def generate_subcommand(os_command, os_subcommand, os_file, extra_params, line_index += 1 if line.startswith('Usage:') and os_command == "swift": line = line[len("Usage: "):] - if line.startswith(('Arguments:', 'Positional arguments:', - 'positional arguments', 'Optional arguments', - 'optional arguments')): + if line.startswith(('Arguments:', + 'Positional arguments:', 'positional arguments', + 'Optional arguments', 'optional arguments', + 'Required arguments', 'required arguments')): if in_para: in_para = False os_file.write("\n") @@ -513,7 +514,14 @@ def generate_subcommand(os_command, os_subcommand, os_file, extra_params, 'optional arguments')): format_help('Optional arguments', help_lines[line_index + 1:], os_file) - break + skip_lines = True + continue + elif line.startswith(('Required arguments:', + 'required arguments')): + format_help('Required arguments', + help_lines[line_index + 1:], os_file) + skip_lines = True + continue else: format_help('Arguments', help_lines[line_index + 1:], os_file) break