mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
Fixed -not option with no arguments bug (#1466)
This commit is contained in:
parent
4dacd86bc3
commit
8458cdb06f
2 changed files with 8 additions and 2 deletions
|
@ -243,10 +243,10 @@ def parse_args(args=[]):
|
||||||
reading.add_argument(
|
reading.add_argument(
|
||||||
"-not",
|
"-not",
|
||||||
dest="excluded",
|
dest="excluded",
|
||||||
nargs="?",
|
nargs=1,
|
||||||
default=[],
|
default=[],
|
||||||
metavar="TAG",
|
metavar="TAG",
|
||||||
action="append",
|
action="extend",
|
||||||
help="Exclude entries with this tag",
|
help="Exclude entries with this tag",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,12 @@ def test_end_date_alone():
|
||||||
assert expected == cli_as_dict("-to 2020-01-01")
|
assert expected == cli_as_dict("-to 2020-01-01")
|
||||||
|
|
||||||
|
|
||||||
|
def test_not_empty():
|
||||||
|
with pytest.raises(SystemExit) as wrapped_e:
|
||||||
|
cli_as_dict("-not")
|
||||||
|
assert wrapped_e.value.code == 2
|
||||||
|
|
||||||
|
|
||||||
def test_not_alone():
|
def test_not_alone():
|
||||||
assert cli_as_dict("-not test") == expected_args(excluded=["test"])
|
assert cli_as_dict("-not test") == expected_args(excluded=["test"])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue