Commit graph

148 commits

Author SHA1 Message Date
Jonathan Wren
7da666f423 Clean up help screen, get rid of util.py (#1027)
* More refactoring of cli.py

break up code from cli.py (now in jrnl.py) up into smaller functions
get rid of export mode
move --encrypt and --decrypt to commands.py
clean up the help screen even more
update flag name for import

* reorganize code, move around lots of functions

* clean up import statements

* move run function out of cli and into jrnl

* rename confusingly named function

* move editor function into editor file

* rename parse_args.py to args.py to make room for more args functions

* Fix error in test suite for windows

I accidentally flipped the conditional, so this fixes it.

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>

* Update app description on help screen

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2020-08-22 11:40:39 -07:00
Jonathan Wren
57ba5e1b29 fix typo in test 2020-08-01 15:54:13 -07:00
Jonathan Wren
9d1ab76fdb Fix small bug related to starring an entry with a date
If a date was given with an entry, and the star was also was added, the
star wouldn't be recognized if it was at the start of the title.

Example that didn't work, but now works with this fix:
  jrnl "saturday: *Title words."

This is to be consistent in starring functionality with and without a
date in the entry.
2020-08-01 15:54:13 -07:00
Jonathan Wren
41d06bfc65 Move import to be standalone command to reduce clutter in cli.py 2020-08-01 15:54:13 -07:00
Jonathan Wren
0bc5f9d453 Update arg parsing to better handle optinal journal name
Fixes #520 -and parameter seems to only work for the default journal
2020-08-01 15:54:13 -07:00
Jonathan Wren
a11aa24c7e Allow editing of DayOne entries (#1001)
* add test to repro issue #955

* Allow editing of DayOne entries

* Add broken test for Dayone

Add test for editing Dayone entries (this test currently fails)

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>

* Fix editing logic for DayOneJournal

DayOneJournal previously reimplemented Journal._parse inside of
DayOneJournal.parse_editable_string, and in doing so caused issues
between itself and the class it was inheriting from. This commit fixes
the issue by moving the UUID to be in the body of the entry, rather than
above it. So, then Journal._parse still finds the correct boundaries
between entries, and DayOneJournal then parses the UUID afterward.

Co-authored-by: MinchinWeb <w_minchin@hotmail.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2020-07-18 12:54:52 -07:00
Micah Jerome Ellison
4ca6e3f95f Display warning if Python version is less than 3.7 (#994)
* Add Python version check and faulty test to confirm it's working (should fail on 3.6 build only)
* Apply formatting
* Fix behave Python version test
* Make error message more descriptive and friendly
2020-07-12 16:24:46 -07:00
Micah Jerome Ellison
28093894ad Add diagnostic argument #727 (#984) 2020-06-20 11:18:53 -07:00
eshrh
be38cfa87a Add tags to json and xml exporters (#975)
* tag array for json
* add tags to entry in xml
* xml test
* json test
* black
* removed called
2020-06-13 11:58:35 -07:00
eshrh
2a3fd820b9 Create journal with absolute path when no path is specified (#972)
* create jrnl with abspath

Co-authored-by: = <esrh@netc.eu>
2020-06-13 11:08:22 -07:00
Eshan
74724b2185 Create directory if it doesn't exist (#963)
* create dir if it doesn't exist
* switch order of print and creation
* makedirs instead of mkdir and stderr printing
* add test
* black reformatting
2020-06-06 12:46:06 -07:00
MinchinWeb
404760876f Add extended metadata support for DayOne Classic (#928)
* Updating changelog [ci skip]

* Incrementing version to v2.4 [ci skip]

* [DayOne] remove extra spaces from the titles of edited DayOne entries

Otherwise, a leading space was being introduced

* [DayOne] maintain existing tags stored in DayOne metadata

* [DayOne] brings back extended DayOne attributes

* [DayOne] maintain metadata on edited entries

Fixes #358, See also #159

* [DayOne Exporter] apply black formatting

* [JSON Exporter] add support for extended DayOne Metadata

* [DayOne] [Tests] test that extended DayOne metadata is added to new entries

Co-authored-by: Jrnl Bot <jrnl.bot@gmail.com>
2020-06-06 12:41:15 -07:00
Eshan
0b9137c17d Fix set_keychain errors (#964)
* fix keyring problems
* black
* remove else and use stderr
* black
* add tests
* black
* change description of nokeyring
* dumb syntax error
2020-05-30 12:43:10 -07:00
Jonathan Wren
7c7e2fae82 Fix for hanging Windows tests on Travis (#969) 2020-05-27 18:22:09 -07:00
Eshan
b575174a60 Fix title splitting logic to account for both newlines and periods (#958)
* remove period parsing in title
* fix title splitter
* revert title-body switch
* keep both splitting types
* make black happy
* make it lstrip not strip
* fix title-body order for the last time
* make black happy again
* added test
* second test for single line entry with punctuation
* delete extra blank lines
2020-05-27 14:14:39 -07:00
Jonathan Wren
a4d020423f Fix editor config when an argument with a space is used (#953)
* Fix editor config when an argument with a space is used
* skip broken test on windows
* fix jrnl not behaving nicely with testing suite
* fix argument parsing for test suite
* fix one windows test, disable one windows test
2020-05-23 15:56:31 -07:00
Micah Jerome Ellison
fcf42e3233 Fix duplicate text in multiple tag search by removing selective coloring on searched tags only #926 (#948) 2020-05-09 15:13:16 -07:00
MinchinWeb
cfadcd39ca Apply isort Mk II (#942)
* Apply isort!
2020-05-09 13:14:43 -07:00
Jonathan Wren
ecb4562c29 Make sure testing cleans up after itself (#940)
This adds the ability to run commands in a cache directory without the
test writer knowing where the cache directory is located. This will let
us expand later if we want to start using system temp folders, without
having to rewrite any of our tests.

* clean up extra directories after running behave
* clean up white space issues
* move repeated code into function
* clean up behave code for creating cache directories
* Fix for windows shell parsing in our test suite

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2020-05-06 18:13:36 -07:00
Micah Jerome Ellison
d9ebfe852b Prevent filtered delete from deleting journal (#935)
* Prevent filtered deletion from deleting entire journal #932 and add lots of deletion tests
* Undo removal of deletion feature
* Use more performant deletion
2020-05-06 13:47:39 -07:00
Jonathan Wren
6a0ee48f83 Disable --delete due to critical bug (#934) 2020-05-02 13:17:06 -07:00
MinchinWeb
68ad5c0c1a Ensure exported entries end in a newline for Markdown and YAML exporters (#908)
* [Markdown Exporter] [YAML Exporter] Ensure exported entires end in a newline

Fixes #768, Fixes #881.

If the exported entry does not have a final empty line, this will add one on export. Some Markdown parsers get picky about not having a empty line above a heading....

* fix black formatting issues
* explicitly sort filenames

to deal with inconsistent default file ordering on different OS's
* Update .gitignore
* Update test for typo fix

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2020-04-18 12:35:46 -07:00
Jonathan Wren
e3a46e9846 fix various small issues in the codebase 2020-04-18 12:35:46 -07:00
MinchinWeb
42bebd5632 Test Version match (#887)
* [Tests] makes sure `--version` works
Directly reads the version number from pyproject.toml

* Tag the tests
To run just this test, use `behave --tags=deployments_tests`
2020-04-18 12:35:46 -07:00
MinchinWeb
65045cc332 [YAML Exporter] fix starred spelling (#907)
* fix starred spelling
c.f. #835
2020-04-18 12:35:46 -07:00
notbalanced
aece970751 Properly display entries during a tag search. (#902) 2020-04-10 16:18:34 -07:00
Jonathan Wren
0e1f415c97 Fix failing tests and linting issues 2020-04-10 16:18:34 -07:00
dbxnr
65a3b2ce7c Fix for upgrade with missing journal (#796)
* Fix for upgrade with missing journal
* add test, refactor solution
* add missing test config

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2020-04-10 16:18:34 -07:00
dbxnr
15429d4f61 Interactive delete (#850)
* fixup alichtman's implementation
* cleanup imports

Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2020-04-10 16:18:34 -07:00
Aaron Lichtman
f4fca3e5a4 Add --delete for interactive removal of entries (#698)
* Add --delete for interactive removal of entries
* Add inquirer dependency for fancy prompting
* Fix some minor style issues
* Fix #434 
* Use PyInquirer instead of inquirer for Windows compatibility
* Add WIP (broken) test
* Change deletion interface to be more basic
* Update environment.py

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2020-04-10 16:18:34 -07:00
Jonathan Wren
302d353c4d Fix up tests and related issues
Upgrade poetry if already installed
Get rid of test function that was causing windows problems
2020-04-10 11:51:56 -07:00
Aaron Lichtman
9e5d160bbd Pretty print journal entries (#692)
* Pretty print journal entry titles and dates.

Changes appearance of all jrnl viewing commands, such as $ jrnl --short and
$ jrnl -n {NUM}.

Fix #508

* Removed extra newline at end of title

* Use ansiwrap to properly wrap strings with ANSI escapes

* Add ansiwrap to pyproject.toml

* Allow configuration of colors

- Replaced raw escapes with colorama
- Added colors key to config
- Add checks for validity of color values

* Add color configuration documentation

* Fix broken tests due to config change

* Add tests for colors in configs

- Identifying invalid color configs
- Upgrading config from no colors -> colors

* Add colorama dependency for all platforms

* Allow users to disable colorization of output

* Update poetry.lock

* Add tag and body color customization options

* Fix colorization of tags in title and body

* Updated tests to use no color by default

* Change pass to continue in verify_config()

* Better style in Entry.py

* Reduce code duplication for tag highlighting

- Breaks "unreadable date" regression test for unknown reason

* Properly colorize tags and print body

* Reformatting and clean up

* Replace list comprehension with generator

* Handle invalid colors by not using a color

* Process ANSI escapes properly with behave

* Fixed the 'spaces after tags directly next to punctuation' bug

Broke processing of tags next to any punctuation at all

* Closer to working tag colorization but not perfect

* Add tests printing for multiline journals

Fix #717

* Correctly indent first line of multiline entry

* Add test for multiline entries with tags

* Remove redundant UNICODE flag

* Progress towards proper tag colorization and body formatting

* Fix newline colorization bug

Debug code left intact since there are more bugs to fix :/

* And now the space just ends up before the tag instead of after it

* Fix assertion syntax warning

* Moved tag test to tagging.feature file

* Strip out debug code and clean up

* Bold datetimes in title

* Bold all titles

Fix #720

* Remove PY2 and PY3 constants

* Fix regression in features/steps/core.py

* Fix tag_regex

* Remove redundant re.UNICODE flag

* Remove extraneous code
2020-04-10 11:51:56 -07:00
Micah Jerome Ellison
6985de2844 Add support to save journals to multiple files in a directory
Update FolderJournal reference to entry __unicode__ method to __str__
Remove DayOne test made obsolete by FolderJournal
Fix FolderJournal path tests for Windows paths
Apply Black linting
2020-04-10 11:51:56 -07:00
Craig Moyer
a3c81d46fe Add support for folder base journal.
Adds feature for issue #170 (and #398) where you configure your journal to
be a directory and entries are added as sub-directories and files:
yyyy/mm/dd.txt. Multiple entries in a day will go in the same file, but a
new entry for a specific day will create a new file (and directory
structure).

Fix failed test scenarios for folder journal.
2020-04-10 11:51:56 -07:00
Micah Jerome Ellison
32bd4a2b71 Restore emoji test now that it works in Windows Travis builds 2020-04-10 11:51:56 -07:00
Jonathan Wren
9acdba1ec7 Update old links (#844)
Since we moved the core repo to jrnl-org, the old links no longer work.
2020-04-10 11:51:56 -07:00
MinchinWeb
cec0beff9a Listing all entries in DayOne Classic journal throws IndexError (#786)
* Reproduce bug in #780
🎵 I have no body, no body to love me... 🎵
The bug is cause by a DayOne entry that has to entry body.

* Deal with empty bodies
Close #780.

* [Travis-CI] add "tree" command to debug missing files
* Fix file location
I have no idea why, but it ran locally fine without issue. Travis is more particular...
2020-04-10 11:51:56 -07:00
MinchinWeb
66027e7746 Add UTC support for failing DayOne tests (#785)
* [Dayone] don't break if the system timezone is UTC
* [DayOne] re-enable tests that were failing on Travis
* [DayOne] change as per code review to avoid `except: pass`
2020-04-10 11:51:56 -07:00
Stav Shamir
8b7ebe2dcd Add test scenarios for the export feature (#824)
* Fix behave keyword "and" to correct case "And"
* Extract export_steps module
* Add scenario for XML export
* Add scenario for tags export
* Add scenario for fancy export
* Add scenario for yaml export
* Remove unused module export.py
* Run `make format`
* Fix `create_directory` step
2020-04-10 11:51:56 -07:00
Micah Jerome Ellison
a3a161376e Keep skip_win directive for empty entry test that still stalls on Travis 2020-04-10 11:51:56 -07:00
Micah Jerome Ellison
923e0c25d5 Remove all skip_win directives now that Travis is not mangling newlines on Windows 2020-04-10 11:51:56 -07:00
Jonathan Wren
fde2cc83b0 skip more windows tests 2020-04-10 11:51:56 -07:00
Jonathan Wren
7f919fd071 run black 2020-04-10 11:51:56 -07:00
Jonathan Wren
6a675791a2 skip another windows test 2020-04-10 11:51:56 -07:00
Jonathan Wren
72e87c15c9 whitespace changes 2020-04-10 11:51:56 -07:00
Jonathan Wren
6428a461b8 skip another windows test 2020-04-10 11:51:56 -07:00
Jonathan Wren
5f31e1ab39 remove broken test (windows can't handle emoji) 2020-04-10 11:51:56 -07:00
Jonathan Wren
4086573f9d [#766] Skip another broken windows test 2020-04-10 11:51:56 -07:00
Jonathan Wren
da55914ec3 [#766] Skip the broken test on windows for now 2020-04-10 11:51:56 -07:00
MinchinWeb
04f6154c93 Apply black formatter to code
[Travis] add a linting stage (via `black`)
[Travis] update as per code review
Remove "Lint" as separate stage; have `black` check the output rather
than run the re-formmater
2020-04-10 11:51:56 -07:00