From dba8e4ac01f559515a4a554ef5589eed81cb0e31 Mon Sep 17 00:00:00 2001 From: Atsushi SAKAI Date: Tue, 25 Aug 2015 22:44:18 +0900 Subject: [PATCH] Fix mis-option identification for doc-tools-update-cli-reference Fixes 1)"--json JSON JSON" case 2)"--id ID" case Change-Id: Ide1edce538c7316a1ddd7e6ddc9bd4b7aacfc43e Closes-Bug: #1488505 --- os_doc_tools/commands.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/os_doc_tools/commands.py b/os_doc_tools/commands.py index b1b2d810..07be385f 100644 --- a/os_doc_tools/commands.py +++ b/os_doc_tools/commands.py @@ -151,14 +151,16 @@ def extract_options(line): # We have a command or parameter to handle # Differentiate: - # 1. --version - # 2. --timeout - # 3. --service , --service-id - # 4. -v, --verbose - # 5. -p PORT, --port PORT - # 6. ID of the backup to restore. - # 7. --alarm-action - # 8. Name or ID of stack to resume. + # 1. --version + # 2. --timeout + # 3. --service , --service-id + # 4. -v, --verbose + # 5. -p PORT, --port PORT + # 6. ID of the backup to restore. + # 7. --alarm-action + # 8. Name or ID of stack to resume. + # 9. --json JSON JSON representation of node group template. + # 10. --id ID of the cluster to show. split_line = line.split(None, 2) @@ -187,12 +189,16 @@ def extract_options(line): else: i += 1 + skip_is_option = False while len(words) > 1: if words[1].startswith('DEPRECATED'): break if last_was_option: if (words[1].startswith(("-", '<', '{', '[')) or - is_option(words[1])): + (is_option(words[1]) and skip_is_option is False)): + skip_is_option = False + if words[1].isupper() or words[1].startswith('<'): + skip_is_option = True words[0] = words[0] + ' ' + words[1] del words[1] else: