diff --git a/AUTHORS.txt b/AUTHORS.txt index 5c8a9faa9..80ac4ada6 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -59,3 +59,4 @@ Pi R Alnoman Kamil - noman [at] kamil [dot] gr - https://kamil.gr Leonardo Taccari - iamleot [at] gmail [dot] com Jorenar - dev [at] jorenar [dot] com - https://jorenar.com +John Wassilak - john [at] wassilak [dot] com diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b126567ed..bed684aa9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,12 @@ Package maintainers and users who have to manually update their installation may want to subscribe to `GitHub's tag feed `_. +0.14.2 +====== +unreleased +* FIX ``khal import --format``/``-f`` was accepted and then ignored, always + falling back to ``view.event_format`` + 0.14.1 ====== 2026-08-21 diff --git a/khal/cli.py b/khal/cli.py index 9570a1e98..e207535a7 100644 --- a/khal/cli.py +++ b/khal/cli.py @@ -341,6 +341,7 @@ def isatty(_file): ics=ics_str, batch=batch, random_uid=random_uid, + format=format, env={"calendars": ctx.obj["conf"]["calendars"]}, ) except FatalError as error: diff --git a/tests/cli_test.py b/tests/cli_test.py index cc5baf9ce..0f7cbe335 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -644,6 +644,30 @@ def test_import_proper(runner): assert result.output == "09.04.-09.04. An Event\n" +def test_import_format(runner): + """`--format` should be honored, not silently replaced by view.event_format.""" + runner = runner() + result = runner.invoke( + main_khal, + ["import", "--format", "{title}", _get_ics_filepath("cal_d")], + input="0\ny\n", + ) + assert not result.exception + assert result.output.startswith("An Event") + + +def test_import_format_repeat_pattern(runner): + """The recurrence rule is available on import, like anywhere else.""" + runner = runner() + result = runner.invoke( + main_khal, + ["import", "-f", "{title} {repeat-pattern}", _get_ics_filepath("event_r_past")], + input="0\ny\n", + ) + assert not result.exception + assert result.output.startswith("Dummy's Birthday (1965) FREQ=YEARLY") + + def test_import_proper_invalid_timezone(runner): runner = runner() result = runner.invoke(