fix commands.json generator, 608 -> 687 commands!

This commit is contained in:
Philippe Teuwen 2022-02-16 14:52:26 +01:00
parent c5658f2a0b
commit fbc60ccbbb
3 changed files with 1210 additions and 759 deletions

View file

@ -68,13 +68,13 @@ def build_help_regex():
# Reads if the command is available offline
re_offline = r'available offline: (?P<offline>yes|no)\n+'
# Reads the description lines
re_description = r'(?P<description>(.|\n)+?)\n+'
re_description = r'(?P<description>(?:.+\n)+)\n+'
# Reads the usage string
re_usage = r'usage:\n(?P<usage>(?:.+\n)+)\n+'
re_usage = r'(?:usage:\n(?P<usage>(?:.+\n)+)\n+)?'
# Reads the options and there individual descriptions
re_options = r'options:\n(?P<options>(?:.+\n)+)\n'
re_options = r'(?:options:\n(?P<options>(?:.+\n)+)\n+)?'
# Reads the notes and examples
re_notes = r'examples\/notes:\n(?P<notes>(?:.+\n)+)'
re_notes = r'(?:examples\/notes:\n(?P<notes>(?:.+\n)+)\n+)?'
# Combine them into a single regex object
re_full = re.compile(re_command+re_offline+re_description+re_usage+re_options+re_notes, re.MULTILINE);
return re_full
@ -181,6 +181,8 @@ def remove_extra_whitespace(text):
def text_to_oneliner(text):
"""Converts a multi line string into a single line string and removes extra whitespace"""
if text is None:
return ""
# Ensure input is a string
text = str(text)
# Replace newlines with spaces
@ -192,6 +194,8 @@ def text_to_oneliner(text):
def text_to_list(text):
"""Converts a multi line string into a list of lines and removes extra whitespace"""
if text is None:
return []
# Ensure input is a string
text = str(text)
# Get all the lines