(doc)
| 462 | |
| 463 | |
| 464 | def printable_usage(doc): |
| 465 | # in python < 2.7 you can't pass flags=re.IGNORECASE |
| 466 | usage_split = re.split(r'([Uu][Ss][Aa][Gg][Ee]:)', doc) |
| 467 | if len(usage_split) < 3: |
| 468 | raise DocoptLanguageError('"usage:" (case-insensitive) not found.') |
| 469 | if len(usage_split) > 3: |
| 470 | raise DocoptLanguageError('More than one "usage:" (case-insensitive).') |
| 471 | return re.split(r'\n\s*\n', ''.join(usage_split[1:]))[0].strip() |
| 472 | |
| 473 | |
| 474 | def formal_usage(printable_usage): |
searching dependent graphs…