diff --git a/jrnl/args.py b/jrnl/args.py index dba5a749..6a2a86ea 100644 --- a/jrnl/args.py +++ b/jrnl/args.py @@ -243,10 +243,10 @@ def parse_args(args=[]): reading.add_argument( "-not", dest="excluded", - nargs="?", + nargs=1, default=[], metavar="TAG", - action="append", + action="extend", help="Exclude entries with this tag", ) diff --git a/tests/unit/test_parse_args.py b/tests/unit/test_parse_args.py index f408c9aa..aadc6684 100644 --- a/tests/unit/test_parse_args.py +++ b/tests/unit/test_parse_args.py @@ -88,6 +88,12 @@ def test_end_date_alone(): 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(): assert cli_as_dict("-not test") == expected_args(excluded=["test"])