Skip to content

Commit 52871b3

Browse files
Vladimir KontićJoão Silva
authored andcommitted
!43 improve Scan date filters help messages, create Scan filters args group Closes #82
1 parent ad0f5d7 commit 52871b3

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

probely_cli/cli/commands/scans/parsers.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,27 @@ def build_scan_filters_parser() -> argparse.ArgumentParser:
3333
help="Filter by Scan status",
3434
)
3535

36+
date_filters_group = scan_filters_parser.add_argument_group(
37+
"Date Filters",
38+
"Specify the date or datetime for filtering Scans. Use the ISO 8601 format, "
39+
"for example: `2020-07-05` for a date, or `2020-07-05T12:45:30` for a datetime.",
40+
)
3641
for date_field in ["completed", "started"]:
37-
for filter_lookup in ["gt", "gte", "lt", "lte"]:
38-
scan_filters_parser.add_argument(
42+
for filter_lookup, description in {
43+
"gt": "after",
44+
"gte": "on or after",
45+
"lt": "before",
46+
"lte": "on or before",
47+
}.items():
48+
date_filters_group.add_argument(
3949
f"--f-{date_field}-{filter_lookup}",
4050
action="store",
4151
default=None,
4252
metavar="DATETIME",
4353
help=(
44-
f"Filter Scans `{date_field}` datetime `{filter_lookup.upper()}` "
45-
f"the specified date or datetime in ISO 8601 format. "
46-
f"For example, `2020-07-05` for a date or `2020-07-05T12:45:30` for a datetime."
54+
f"Show scans {date_field} {description} the specified date or datetime."
4755
),
4856
)
49-
5057
return scan_filters_parser
5158

5259

0 commit comments

Comments
 (0)