From 598c0e97cea6503ab7aad0e6944a5a05527676cc Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 14 Aug 2013 14:00:32 -0700 Subject: [PATCH 1/7] Prevents journal from printing when composing an entry This fixes #87 --- jrnl/jrnl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/jrnl.py b/jrnl/jrnl.py index 256075ce..5763a90d 100755 --- a/jrnl/jrnl.py +++ b/jrnl/jrnl.py @@ -184,7 +184,7 @@ def cli(manual_args=None): journal.limit(args.limit) # Reading mode - if not mode_export: + if not mode_compose and not mode_export: print(journal.pprint()) # Various export modes From 3549eff21520ff677becf784e4374c3c1aa515d5 Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 14 Aug 2013 14:00:42 -0700 Subject: [PATCH 2/7] Adds regression test for #87 --- features/regression.feature | 8 ++++++++ features/steps/core.py | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 features/regression.feature diff --git a/features/regression.feature b/features/regression.feature new file mode 100644 index 00000000..c4cf41e7 --- /dev/null +++ b/features/regression.feature @@ -0,0 +1,8 @@ +Feature: Zapped bugs should stay dead. + + Scenario: Writing an entry does not print the entire journal + Given we use the config "basic.json" + When we run "jrnl 23 july 2013: A cold and stormy day. I ate crisps on the sofa." + Then we should see the message "Entry added" + When we run "jrnl -n 1" + Then the output should not contain "Life is good" diff --git a/features/steps/core.py b/features/steps/core.py index bceab051..f6c54564 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -102,6 +102,11 @@ def check_output_inline(context, text): out = context.stdout_capture.getvalue() assert text in out +@then('the output should not contain "{text}"') +def check_output_not_inline(context, text): + out = context.stdout_capture.getvalue() + assert text not in out + @then('we should see the message "{text}"') def check_message(context, text): out = context.messages.getvalue() From 2025fe5b51c45ac5b5ad886808e85a229b307b0d Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 14 Aug 2013 14:01:13 -0700 Subject: [PATCH 3/7] Version bump --- jrnl/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/__init__.py b/jrnl/__init__.py index 6c783c61..7fbaf4e5 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -7,7 +7,7 @@ jrnl is a simple journal application for your command line. """ __title__ = 'jrnl' -__version__ = '1.5.0' +__version__ = '1.5.1' __author__ = 'Manuel Ebert' __license__ = 'MIT License' __copyright__ = 'Copyright 2013 Manuel Ebert' From 28a5c66193a087c504ea7c40181a9f3fe8403c99 Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 14 Aug 2013 14:06:39 -0700 Subject: [PATCH 4/7] Soft-deprecates `-to` and introduces `-until` --- jrnl/jrnl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/jrnl.py b/jrnl/jrnl.py index 5763a90d..97c01d74 100755 --- a/jrnl/jrnl.py +++ b/jrnl/jrnl.py @@ -39,7 +39,7 @@ def parse_args(args=None): reading = parser.add_argument_group('Reading', 'Specifying either of these parameters will display posts of your journal') reading.add_argument('-from', dest='start_date', metavar="DATE", help='View entries after this date') - reading.add_argument('-to', dest='end_date', metavar="DATE", help='View entries before this date') + reading.add_argument('-until', '-to', dest='end_date', metavar="DATE", help='View entries before this date') reading.add_argument('-and', dest='strict', action="store_true", help='Filter by tags using AND (default: OR)') reading.add_argument('-n', dest='limit', default=None, metavar="N", help='Shows the last n entries matching the filter', nargs="?", type=int) reading.add_argument('-short', dest='short', action="store_true", help='Show only titles or line containing the search tags') From bf4eb7a88cd70112f231a4415613c3df2ba52284 Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 14 Aug 2013 14:06:53 -0700 Subject: [PATCH 5/7] Updates tests --- features/exporting.feature | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/features/exporting.feature b/features/exporting.feature index 7f58876f..5b3e940f 100644 --- a/features/exporting.feature +++ b/features/exporting.feature @@ -10,13 +10,13 @@ Feature: Expoting a Journal and "tags" in the json output should contain "@journal" and "tags" in the json output should contain "@dan" - Scenario: Exporting using filters should only export parts of the journal - Given we use the config "tags.json" - When we run "jrnl -to 'may 2013' --export json" - # Then we should get no error - Then the output should be parsable as json - and "entries" in the json output should have 1 element - and "tags" in the json output should contain "@idea" - and "tags" in the json output should contain "@journal" - and "tags" in the json output should not contain "@dan" + Scenario: Exporting using filters should only export parts of the journal + Given we use the config "tags.json" + When we run "jrnl -until 'may 2013' --export json" + # Then we should get no error + Then the output should be parsable as json + and "entries" in the json output should have 1 element + and "tags" in the json output should contain "@idea" + and "tags" in the json output should contain "@journal" + and "tags" in the json output should not contain "@dan" From 680ebac8e7b081e7e0bc4e19dd12b1b714baeb60 Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 14 Aug 2013 14:07:57 -0700 Subject: [PATCH 6/7] Version bump --- jrnl/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/__init__.py b/jrnl/__init__.py index 7fbaf4e5..4ee7ee31 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -7,7 +7,7 @@ jrnl is a simple journal application for your command line. """ __title__ = 'jrnl' -__version__ = '1.5.1' +__version__ = '1.5.2' __author__ = 'Manuel Ebert' __license__ = 'MIT License' __copyright__ = 'Copyright 2013 Manuel Ebert' From 857583953e3fcc98ac5d2320ec4cf4b06479d5ff Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 14 Aug 2013 14:08:05 -0700 Subject: [PATCH 7/7] Readme + changelog update --- CHANGELOG.md | 8 ++++++++ README.md | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca77eb20..cebd5e32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Changelog ========= +### 1.5.2 + +* [Improved] Soft-deprecated `-to` for filtering by time and introduces `-until` instead. + +### 1.5.1 + +* [Fixed] Fixed a bug introduced in 1.5.0 that caused the entire journal to be printed after composing an entry + ### 1.5.0 * [Improved] Exporting, encrypting and displaying tags now takes your filter options into account. So you could export everything before May 2012: `jrnl -to 'may 2012' --export json`. Or encrypt all entries tagged with `@work` into a new journal: `jrnl @work --encrypt work_journal.txt`. Or display all tags of posts where Bob is also tagged: `jrnl @bob --tags` diff --git a/README.md b/README.md index 71fe1716..e92ba029 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ _jrnl_ has two modes: __composing__ and __viewing__. will list you the ten latest entries, - jrnl -from "last year" -to march + jrnl -from "last year" -until march everything that happened from the start of last year to the start of last march. If you only want to see the titles of your entries, use