From 41bec199a2a5774599656ac91eeb8bd59b0c31a2 Mon Sep 17 00:00:00 2001 From: flight16 Date: Sat, 11 Apr 2015 13:03:15 +0900 Subject: [PATCH 1/4] Add missing dependencies pyyaml and pyxdg --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 23ca9ed0..0c1b4036 100644 --- a/setup.py +++ b/setup.py @@ -89,7 +89,9 @@ setup( "PyYAML>=3.11", "keyring>=3.3", "passlib>=1.6.2", - "python-dateutil>=2.2" + "python-dateutil>=2.2", + "pyyaml>=3.09", + "pyxdg>=0.25", ] + [p for p, cond in conditional_dependencies.items() if cond], long_description=__doc__, entry_points={ From 00a5657c1b2883023554eea2601adeb5a59ba718 Mon Sep 17 00:00:00 2001 From: flight16 Date: Mon, 13 Apr 2015 09:01:10 +0900 Subject: [PATCH 2/4] Fix: dateutil conflict because python-dateutils was already added to the conditional section. --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index bcd80e54..5b885326 100644 --- a/setup.py +++ b/setup.py @@ -89,7 +89,6 @@ setup( "PyYAML>=3.11", "keyring>=3.3", "passlib>=1.6.2", - "python-dateutil>=2.2", "pyyaml>=3.09", "pyxdg>=0.25", ] + [p for p, cond in conditional_dependencies.items() if cond], From b2a7d1f30e3867354196fc7ef6a365820dbc26f2 Mon Sep 17 00:00:00 2001 From: flight16 Date: Mon, 13 Apr 2015 09:08:43 +0900 Subject: [PATCH 3/4] Add single letter alias -s for option --short --short was being used in a test for date logic, but I added a second test for explicitness. --- features/core.feature | 8 ++++++++ jrnl/cli.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/features/core.feature b/features/core.feature index 08f7aea8..7ad048f5 100644 --- a/features/core.feature +++ b/features/core.feature @@ -47,3 +47,11 @@ Feature: Basic reading and writing to a journal When we run "jrnl -v" Then we should get no error Then the output should contain "version" + + Scenario: --short and -s display the short version of entries (only the title) + Given we use the config "basic.yaml" + When we run "jrnl -on 2013-06-10 --short" + Then the output should be "2013-06-10 15:40 Life is good." + When we run "jrnl -on 2013-06-10 -s" + Then the output should be "2013-06-10 15:40 Life is good." + diff --git a/jrnl/cli.py b/jrnl/cli.py index 389afc0a..11388ca7 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -38,7 +38,7 @@ def parse_args(args=None): reading.add_argument('-n', dest='limit', default=None, metavar="N", help="Shows the last n entries matching the filter. '-n 3' and '-3' have the same effect.", nargs="?", type=int) exporting = parser.add_argument_group('Export / Import', 'Options for transmogrifying your journal') - exporting.add_argument('--short', dest='short', action="store_true", help='Show only titles or line containing the search tags') + exporting.add_argument('-s', '--short', dest='short', action="store_true", help='Show only titles or line containing the search tags') exporting.add_argument('--tags', dest='tags', action="store_true", help='Returns a list of all tags and number of occurences') exporting.add_argument('--export', metavar='TYPE', dest='export', choices=plugins.BaseExporter.PLUGIN_NAMES, help='Export your journal. TYPE can be %s.' % plugins.BaseExporter.get_plugin_types_string(), default=False, const=None) exporting.add_argument('-o', metavar='OUTPUT', dest='output', help='Optionally specifies output file when using --export. If OUTPUT is a directory, exports each entry into an individual file instead.', default=False, const=None) From 35b9827eb17b8a5d20ebc528b75878ceca1f5c40 Mon Sep 17 00:00:00 2001 From: flight16 Date: Mon, 13 Apr 2015 23:22:52 +0900 Subject: [PATCH 4/4] Fix breaking test submitted in b2a7d1f30e3867354196fc7ef6a365820dbc26f2. --- features/core.feature | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/features/core.feature b/features/core.feature index 7ad048f5..da22dfd7 100644 --- a/features/core.feature +++ b/features/core.feature @@ -48,10 +48,13 @@ Feature: Basic reading and writing to a journal Then we should get no error Then the output should contain "version" + # The quotes around the date in the second run are intentional. Without + # them, the behave will fail because it finds duplicate output. I couldn't + # track down the issue after an hour of debugging, so I've submitted as-is. Scenario: --short and -s display the short version of entries (only the title) - Given we use the config "basic.yaml" - When we run "jrnl -on 2013-06-10 --short" - Then the output should be "2013-06-10 15:40 Life is good." - When we run "jrnl -on 2013-06-10 -s" - Then the output should be "2013-06-10 15:40 Life is good." + Given we use the config "basic.yaml" + When we run "jrnl -on 2013-06-10 --short" + Then the output should be "2013-06-10 15:40 Life is good." + When we run "jrnl -on '2013-06-10' -s" + Then the output should be "2013-06-10 15:40 Life is good."