| @@ 99-161 (lines=63) @@ | ||
| 96 | return period_start, period_end |
|
| 97 | ||
| 98 | ||
| 99 | def parse_args(args: Namespace) -> Namespace: # pylint: disable=unused-argument |
|
| 100 | """ Parsing args ... """ |
|
| 101 | ||
| 102 | parser = ArgumentParser( |
|
| 103 | prefix_chars='+', |
|
| 104 | add_help=False, |
|
| 105 | formatter_class=RawTextHelpFormatter, |
|
| 106 | description=HELP_TEXT, |
|
| 107 | ) |
|
| 108 | ||
| 109 | parser.add_argument( |
|
| 110 | '+h', |
|
| 111 | '++help', |
|
| 112 | action='help', |
|
| 113 | help='Show this help message and exit.', |
|
| 114 | ) |
|
| 115 | ||
| 116 | parser.add_argument( |
|
| 117 | '+p', |
|
| 118 | '++period', |
|
| 119 | nargs=2, |
|
| 120 | type=str, |
|
| 121 | required=True, |
|
| 122 | dest='period', |
|
| 123 | help=( |
|
| 124 | 'Choose a time period that is filtering the tasks.\n' |
|
| 125 | 'Use the date format YYYY/MM/DD.' |
|
| 126 | ), |
|
| 127 | ) |
|
| 128 | ||
| 129 | parser.add_argument( |
|
| 130 | '+t', |
|
| 131 | '++tags', |
|
| 132 | nargs='+', |
|
| 133 | type=str, |
|
| 134 | dest='tags', |
|
| 135 | help=( |
|
| 136 | 'Filter the tasks by given tag(s).\n' |
|
| 137 | 'If you pass more than on tag, they will be concatenated with ' |
|
| 138 | or '\n' |
|
| 139 | 'You can pass tag names, tag ids or tag name=value to this argument' |
|
| 140 | ), |
|
| 141 | ) |
|
| 142 | ||
| 143 | filter_args = parser.add_mutually_exclusive_group() |
|
| 144 | ||
| 145 | filter_args.add_argument( |
|
| 146 | '++filter-terms', |
|
| 147 | nargs='+', |
|
| 148 | type=str, |
|
| 149 | dest='filter_term', |
|
| 150 | help='Filter the results by given filter terms.', |
|
| 151 | ) |
|
| 152 | ||
| 153 | filter_args.add_argument( |
|
| 154 | '++filter-id', |
|
| 155 | type=str, |
|
| 156 | dest='filter_id', |
|
| 157 | help='Filter the results by given filter id.', |
|
| 158 | ) |
|
| 159 | ||
| 160 | script_args, _ = parser.parse_known_args() |
|
| 161 | return script_args |
|
| 162 | ||
| 163 | ||
| 164 | def generate_task_filter( |
|
| @@ 508-555 (lines=48) @@ | ||
| 505 | ) |
|
| 506 | ||
| 507 | ||
| 508 | def parse_args(args: Namespace) -> Namespace: # pylint: disable=unused-argument |
|
| 509 | """ Parsing args ... """ |
|
| 510 | ||
| 511 | parser = ArgumentParser( |
|
| 512 | prefix_chars='+', |
|
| 513 | add_help=False, |
|
| 514 | formatter_class=RawTextHelpFormatter, |
|
| 515 | description=HELP_TEXT, |
|
| 516 | ) |
|
| 517 | ||
| 518 | parser.add_argument( |
|
| 519 | '+h', |
|
| 520 | '++help', |
|
| 521 | action='help', |
|
| 522 | help='Show this help message and exit.', |
|
| 523 | ) |
|
| 524 | ||
| 525 | parser.add_argument( |
|
| 526 | '++create-list', |
|
| 527 | nargs='?', |
|
| 528 | type=str, |
|
| 529 | choices=('no_creation', 'recreate', 'create'), |
|
| 530 | const='create', |
|
| 531 | default='no_creation', |
|
| 532 | dest="create_list", |
|
| 533 | help="Create the CPE to CVE helper list", |
|
| 534 | ) |
|
| 535 | ||
| 536 | parser.add_argument( |
|
| 537 | '+l', |
|
| 538 | '++list', |
|
| 539 | type=str, |
|
| 540 | dest="list", |
|
| 541 | required=True, |
|
| 542 | help="Create the CPE to CVE helper list", |
|
| 543 | ) |
|
| 544 | ||
| 545 | parser.add_argument( |
|
| 546 | '+f', |
|
| 547 | '++file', |
|
| 548 | type=str, |
|
| 549 | dest="json_file", |
|
| 550 | help="File that should be parsed", |
|
| 551 | ) |
|
| 552 | ||
| 553 | args, _ = parser.parse_known_args() |
|
| 554 | ||
| 555 | return args |
|
| 556 | ||
| 557 | ||
| 558 | def main(gmp, args): |
|