Fix mis-option identification for doc-tools-update-cli-reference

Fixes
1)"--json JSON JSON" case
2)"--id <cluster_id> ID" case

Change-Id: Ide1edce538c7316a1ddd7e6ddc9bd4b7aacfc43e
Closes-Bug: #1488505
This commit is contained in:
Atsushi SAKAI 2015-08-25 22:44:18 +09:00
parent ce4c62264f
commit dba8e4ac01
1 changed files with 15 additions and 9 deletions

View File

@ -159,6 +159,8 @@ def extract_options(line):
# 6. <backup> ID of the backup to restore.
# 7. --alarm-action <Webhook URL>
# 8. <NAME or ID> Name or ID of stack to resume.
# 9. --json JSON JSON representation of node group template.
# 10. --id <cluster_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: