|
41 | 41 | import docformatter.format as _format |
42 | 42 |
|
43 | 43 |
|
| 44 | +def _help(): |
| 45 | + """Print docformatter's help.""" |
| 46 | + print( |
| 47 | + """\ |
| 48 | +usage: docformatter [-h] [-i | -c] [-d] [-r] [-e [EXCLUDE ...]] |
| 49 | + [-n [NON-CAP ...]] [--black] [--wrap-summaries length] |
| 50 | + [--wrap-descriptions length] [--force-wrap] |
| 51 | + [--tab-width width] [--blank] [--pre-summary-newline] |
| 52 | + [--pre-summary-space] [--make-summary-multi-line] |
| 53 | + [--close-quotes-on-newline] [--range line line] |
| 54 | + [--docstring-length length length] [--non-strict] |
| 55 | + [--config CONFIG] [--version] files [files ...] |
| 56 | +
|
| 57 | +positional arguments: |
| 58 | + files files to format or '-' for standard in |
| 59 | +
|
| 60 | +options: |
| 61 | + -h, --help show this help message and exit |
| 62 | + -i, --in-place make changes to files instead of printing diffs |
| 63 | + -c, --check only check and report incorrectly formatted files |
| 64 | + -d, --diff when used with `--check` or `--in-place`, also what |
| 65 | + changes would be made |
| 66 | + -r, --recursive drill down directories recursively |
| 67 | + -e [EXCLUDE ...], --exclude [EXCLUDE ...] |
| 68 | + in recursive mode, exclude directories and files by |
| 69 | + names |
| 70 | + -n [NON-CAP ...], --non-cap [NON-CAP ...] |
| 71 | + list of words not to capitalize when they appear as the |
| 72 | + first word in the summary |
| 73 | +
|
| 74 | + --black make formatting compatible with standard black options |
| 75 | + (default: False) |
| 76 | + --wrap-summaries length |
| 77 | + wrap long summary lines at this length; set to 0 to |
| 78 | + disable wrapping (default: 79, 88 with --black option) |
| 79 | + --wrap-descriptions length |
| 80 | + wrap descriptions at this length; set to 0 to disable |
| 81 | + wrapping (default: 72, 88 with --black option) |
| 82 | + --force-wrap force descriptions to be wrapped even if it may result |
| 83 | + in a mess (default: False) |
| 84 | + --tab-width width tabs in indentation are this many characters when |
| 85 | + wrapping lines (default: 1) |
| 86 | + --blank add blank line after description (default: False) |
| 87 | + --pre-summary-newline |
| 88 | + add a newline before the summary of a multi-line |
| 89 | + docstring (default: False) |
| 90 | + --pre-summary-space add a space after the opening triple quotes |
| 91 | + (default: False) |
| 92 | + --make-summary-multi-line |
| 93 | + add a newline before and after the summary of a |
| 94 | + one-line docstring (default: False) |
| 95 | + --close-quotes-on-newline |
| 96 | + place closing triple quotes on a new-line when a |
| 97 | + one-line docstring wraps to two or more lines |
| 98 | + (default: False) |
| 99 | + --range line line apply docformatter to docstrings between these lines; |
| 100 | + line numbers are indexed at 1 (default: None) |
| 101 | + --docstring-length length length |
| 102 | + apply docformatter to docstrings of given length range |
| 103 | + (default: None) |
| 104 | + --non-strict don't strictly follow reST syntax to identify lists |
| 105 | + (see issue #67) (default: False) |
| 106 | + --config CONFIG path to file containing docformatter options |
| 107 | + --version show program's version number and exit |
| 108 | +""" |
| 109 | + ) |
| 110 | + |
| 111 | + |
44 | 112 | def _main(argv, standard_out, standard_error, standard_in): |
45 | 113 | """Run internal main entry point.""" |
46 | 114 | configurator = _configuration.Configurater(argv) |
47 | | - configurator.do_parse_arguments() |
| 115 | + |
| 116 | + if "--help" in configurator.args_lst: |
| 117 | + _help() |
| 118 | + sys.exit() |
| 119 | + else: |
| 120 | + configurator.do_parse_arguments() |
48 | 121 |
|
49 | 122 | formator = _format.Formatter( |
50 | 123 | configurator.args, |
|
0 commit comments