mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-19 06:29:53 +08:00
fix regex for extracting the description and notes.\n description now must start with a newline and go until it see the word usage:. \n\n notes now go until it sees either === or --- or \n\n\n which all would be indication that the notes section ended.
This commit is contained in:
parent
c12a54e8e2
commit
66b3ebabb9
2 changed files with 287 additions and 759 deletions
|
@ -62,21 +62,19 @@ def build_arg_parser():
|
|||
|
||||
|
||||
def build_help_regex():
|
||||
"""The regex uses to parse the full text output of help data from the pm3 client."""
|
||||
# Reads the divider followed by the command itself
|
||||
re_command = r'-{87}\n(?P<command>.+)\n'
|
||||
# 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[\s\S]*?(?=usage:))'
|
||||
# Reads the usage string
|
||||
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+)?'
|
||||
# Reads the notes and examples
|
||||
re_notes = r'(?:examples\/notes:\n(?P<notes>(?:.+\n)+)\n+)?'
|
||||
re_notes = r'(?:examples\/notes:\n(?P<notes>[\s\S]*?(?=(===|---|\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);
|
||||
re_full = re.compile(re_command+re_offline+re_description+re_usage+re_options+re_notes, re.MULTILINE)
|
||||
return re_full
|
||||
|
||||
|
||||
|
|
1038
doc/commands.json
1038
doc/commands.json
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue