Merge pull request #88 from maebert/bugfix-87

Bugfix 87
This commit is contained in:
Manuel Ebert 2013-08-14 14:18:51 -07:00
commit 75e4e72c4a
7 changed files with 34 additions and 13 deletions

View file

@ -1,6 +1,14 @@
Changelog 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 ### 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` * [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`

View file

@ -58,7 +58,7 @@ _jrnl_ has two modes: __composing__ and __viewing__.
will list you the ten latest entries, 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 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

View file

@ -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 "@journal"
and "tags" in the json output should contain "@dan" and "tags" in the json output should contain "@dan"
Scenario: Exporting using filters should only export parts of the journal Scenario: Exporting using filters should only export parts of the journal
Given we use the config "tags.json" Given we use the config "tags.json"
When we run "jrnl -to 'may 2013' --export json" When we run "jrnl -until 'may 2013' --export json"
# Then we should get no error # Then we should get no error
Then the output should be parsable as json Then the output should be parsable as json
and "entries" in the json output should have 1 element 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 "@idea"
and "tags" in the json output should contain "@journal" and "tags" in the json output should contain "@journal"
and "tags" in the json output should not contain "@dan" and "tags" in the json output should not contain "@dan"

View file

@ -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"

View file

@ -102,6 +102,11 @@ def check_output_inline(context, text):
out = context.stdout_capture.getvalue() out = context.stdout_capture.getvalue()
assert text in out 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}"') @then('we should see the message "{text}"')
def check_message(context, text): def check_message(context, text):
out = context.messages.getvalue() out = context.messages.getvalue()

View file

@ -7,7 +7,7 @@ jrnl is a simple journal application for your command line.
""" """
__title__ = 'jrnl' __title__ = 'jrnl'
__version__ = '1.5.0' __version__ = '1.5.2'
__author__ = 'Manuel Ebert' __author__ = 'Manuel Ebert'
__license__ = 'MIT License' __license__ = 'MIT License'
__copyright__ = 'Copyright 2013 Manuel Ebert' __copyright__ = 'Copyright 2013 Manuel Ebert'

View file

@ -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 = 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('-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('-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('-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') reading.add_argument('-short', dest='short', action="store_true", help='Show only titles or line containing the search tags')
@ -184,7 +184,7 @@ def cli(manual_args=None):
journal.limit(args.limit) journal.limit(args.limit)
# Reading mode # Reading mode
if not mode_export: if not mode_compose and not mode_export:
print(journal.pprint()) print(journal.pprint())
# Various export modes # Various export modes