Repository: pimutils/khal

Issue:
Sensible default for printics
printics currently uses agenda_event_format as default:

https://github.com/pimutils/khal/blob/a401ef28076954779cc66885a05dd1fa7da46fe3/khal/controllers.py#L625

Therefore, the date of the event is missing, when it is used to quickly check the contents of an ICS file, kind of missing its purpose. If I do not miss another use case where a date context is somehow given, I suggest to use event_format as format.

Or - in my opinion even better - define an own config value for printics_format that is used and can be tweaked for own purposes without affecting other parts of khal.

Discussion:

Patch:
diff --git a/khal/controllers.py b/khal/controllers.py
index 39699f2..fdae8df 100644
--- a/khal/controllers.py
+++ b/khal/controllers.py
@@ -622,7 +622,7 @@ def import_event(vevent, collection, locale, batch, format=None, env=None):
 
 def print_ics(conf, name, ics, format):
     if format is None:
-        format = conf['view']['agenda_event_format']
+        format = conf['view']['event_format']
     cal = cal_from_ics(ics)
     events = [item for item in cal.walk() if item.name == 'VEVENT']
     events_grouped = defaultdict(list)


Test patch:
diff --git a/tests/cli_test.py b/tests/cli_test.py
index 75f341e..8102ee9 100644
--- a/tests/cli_test.py
+++ b/tests/cli_test.py
@@ -705,7 +705,7 @@ def test_printics_read_from_stdin(runner):
     runner = runner(command='printics')
     result = runner.invoke(main_khal, ['printics'], input=_get_text('cal_d'))
     assert not result.exception
-    assert '1 events found in stdin input\n An Event\n' in result.output
+    assert '1 events found in stdin input\n09.04.-09.04. An Event\n' in result.output
 
 
 def test_configure_command_config_exists(runner):