Coverage for csaf_lint/cli.py: 96.30%
19 statements
« prev ^ index » next coverage.py v7.4.1, created at 2024-02-04 16:41:21 +00:00
« prev ^ index » next coverage.py v7.4.1, created at 2024-02-04 16:41:21 +00:00
1"""Visit folder tree with CSAF or CVRF documents, validate the latter, and generate reports."""
3import os
4import pathlib
5import sys
6from typing import no_type_check
8import csaf_lint.lint as lint
10DEBUG_VAR = 'CSL_DEBUG'
11DEBUG = bool(os.getenv(DEBUG_VAR, ''))
14@no_type_check
15def main(argv=None, debug=None):
16 """Dispatch processing of the job.
17 This is the strings only command line interface.
18 For python API use interact with lint functions directly.
19 """
20 argv = sys.argv[1:] if argv is None else argv
21 embedded = False
22 debug = debug if debug else DEBUG
23 for arg in argv:
24 if not pathlib.Path(arg).is_file(): 24 ↛ 23line 24 didn't jump to line 23, because the condition on line 24 was never false
25 if not embedded:
26 embedded = True
27 else:
28 print('ERROR: embedding only works for none or all.')
29 sys.exit(2)
31 return lint.main(argv, embedded=embedded, debug=debug)