|
50 | 50 | )
|
51 | 51 | _builtin_default = 'clear,rare'
|
52 | 52 |
|
53 |
| -# docs say os.EX_USAGE is only available on Unix systems, so to be safe we |
54 |
| -# protect and just use the value it is on macOS and Linux (64) |
| 53 | +# docs say os.EX_USAGE et al. are only available on Unix systems, so to be safe |
| 54 | +# we protect and just use the values they are on macOS and Linux |
| 55 | +EX_OK = 0 |
55 | 56 | EX_USAGE = 64
|
| 57 | +EX_DATAERR = 65 |
56 | 58 |
|
57 | 59 | # OPTIONS:
|
58 | 60 | #
|
@@ -218,11 +220,11 @@ def parse_options(args):
|
218 | 220 |
|
219 | 221 | parser.add_argument('-d', '--disable-colors',
|
220 | 222 | action='store_false', dest='colors',
|
221 |
| - help='disable colors, even when printing to terminal ' |
| 223 | + help='Disable colors, even when printing to terminal ' |
222 | 224 | '(always set for Windows)')
|
223 | 225 | parser.add_argument('-c', '--enable-colors',
|
224 | 226 | action='store_true', dest='colors',
|
225 |
| - help='enable colors, even when not printing to ' |
| 227 | + help='Enable colors, even when not printing to ' |
226 | 228 | 'terminal')
|
227 | 229 |
|
228 | 230 | parser.add_argument('-w', '--write-changes',
|
@@ -265,11 +267,11 @@ def parse_options(args):
|
265 | 267 | 'specified together with --write-changes.')
|
266 | 268 | parser.add_argument('-s', '--summary',
|
267 | 269 | action='store_true', default=False,
|
268 |
| - help='print summary of fixes') |
| 270 | + help='Print summary of fixes') |
269 | 271 |
|
270 | 272 | parser.add_argument('--count',
|
271 | 273 | action='store_true', default=False,
|
272 |
| - help='print the number of errors as the last line of ' |
| 274 | + help='Print the number of errors as the last line of ' |
273 | 275 | 'stderr')
|
274 | 276 |
|
275 | 277 | parser.add_argument('-S', '--skip',
|
@@ -315,21 +317,21 @@ def parse_options(args):
|
315 | 317 |
|
316 | 318 | parser.add_argument('-f', '--check-filenames',
|
317 | 319 | action='store_true', default=False,
|
318 |
| - help='check file names as well') |
| 320 | + help='Check file names as well') |
319 | 321 |
|
320 | 322 | parser.add_argument('-H', '--check-hidden',
|
321 | 323 | action='store_true', default=False,
|
322 | 324 | help='Check hidden files and directories (those '
|
323 | 325 | 'starting with ".") as well.')
|
324 | 326 | parser.add_argument('-A', '--after-context', type=int, metavar='LINES',
|
325 |
| - help='print LINES of trailing context') |
| 327 | + help='Print LINES of trailing context') |
326 | 328 | parser.add_argument('-B', '--before-context', type=int, metavar='LINES',
|
327 |
| - help='print LINES of leading context') |
| 329 | + help='Print LINES of leading context') |
328 | 330 | parser.add_argument('-C', '--context', type=int, metavar='LINES',
|
329 |
| - help='print LINES of surrounding context') |
| 331 | + help='Print LINES of surrounding context') |
330 | 332 |
|
331 | 333 | parser.add_argument('files', nargs='*',
|
332 |
| - help='files or directories to check') |
| 334 | + help='Files or directories to check') |
333 | 335 |
|
334 | 336 | options = parser.parse_args(list(args))
|
335 | 337 |
|
@@ -758,4 +760,4 @@ def main(*args):
|
758 | 760 | print(summary)
|
759 | 761 | if options.count:
|
760 | 762 | print(bad_count, file=sys.stderr)
|
761 |
| - return int(bool(bad_count)) |
| 763 | + return EX_DATAERR if bad_count else EX_OK |
0 commit comments