* Encapsulate all multiline strings in triple-quotes in Gherkin files
Since pytest-bdd v8.0.0 uses the official Gherkin parser, multiline
strings must now be encapsulated by triple-quotes.
See:
- https://pytest-bdd.readthedocs.io/en/stable/#id2
- https://pytest-bdd.readthedocs.io/en/stable/#docstrings
* Remove comments in Gherkin files causing test breakage
These comments break the step matching.
* Fix compatibility of step-functions matching on multiple lines
In pytest-bdd v8.0.0 it is no longer possible to match based on multiple
lines, which breaks essentially all steps that support docstrings. Solve
this by adding a wrapper-function for each of these instances, that
matches the docstring step, and calls the original function.
So, what used to be:
@then(parse("the output should match\n{regex}"))
@then(parse('the output should match "{regex}"'))
def output_should_match(regex, cli_run):
...
Is now:
@then(parse("the output should match"))
def output_should_match_docstring(cli_run, docstring):
output_should_match(docstring, cli_run)
@then(parse('the output should match "{regex}"'))
def output_should_match(regex, cli_run):
...
There is possibly a way around this that is much better than what I've
done here, but this is a start at least.
* Update version requirement of pytest-bdd to >=8.0
* Update tox config to match poetry config
---------
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Store multiple -contains arguments (OR default).
Allow multiple occurrences of the -contains argument
to be stored in a list. Previously, only the last occurrence was
considered. Additionally, the behavior has been modified to default to
OR logic, meaning that if multiple -contains arguments are provided,
entries matching any of them will be included in the results.
* Solved issue #1877 "-and" flag with multiple instances of the -contains option.
* Run poe format
* Fix unit test for contains to allow list instead of single value
* Add BDD tests for multiple contains with and without -and
* Black version updated.
* Revert pyproject.toml to appease poetry
---------
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Support pytest_bdd 7.1.2 and later
Fix#1875.
* Prevent use of pytest 8.1 for now due to unrelated error
* poetry lock --no-update
---------
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Update dependency black to v24
* update file to match new formatting from black
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Sort packaging deps alphabetically
* De-dupe packaging deps. Only the latest one matters for the changelog
* Add missing PRs and a special thanks note
* Add missing linebreak
* Stop ignoring parsedatetime warning flag style warning
* Use new VERSION_CONTEXT_STYLE to bypass parsedatetime flag style warning
* Replace "flag" and its magic numbers with contextual booleans
* Add python 3.12 beta to PR tests and testing schedule
* Remove -dev suffix from 3.12 version in test runner and allow pre-releases
Reference: https://github.com/actions/setup-python/releases/tag/v4.6.0
* Run poetry lock to get sub-dependencies to update
* Add ruff
* Add ruff config
* Add ruff rules that look useful and are already passing
* Add more ruff rules after talking with Jonathan
* Add line length exception for acceptably long indented line
* Resolve ruff line length 88 rule in args. Changing small lines but adding a noqa ignore directive to longer lines that look best as they are. Their dedented length is still less than 88
* poe format
* Resolve all remaining ruff line length errors
* Replace flake* and isort with ruff calls
* Add black --check as final lint step. ruff catches most but not all black formatting issues
* Remove unneeded flakeheaven setting
* Remove flake* and isort now that ruff is handling all their business
* Update pyproject, lockfile with latest version of ruff
* Document each ruff rule with comment
* Add black --version call before black --check
* Remove extraneous period
* Move path concerns to path.py and template concerns to editor.py -- BDD tests are failing
* Move path-related constants from config.py to path.py
* Mock get_templates_path in its new calling file
* Mediate template arg vs. config in controller then read template text in editor and unify those two use cases.
Some tests still failing
* Fix test whose message had changed
* poe format
* Refactor for easier unit testing and add unit tests
* Use path strings instead of Path objects in return values to prevent side effects that caused unit tests to fail on some platforms
* poe format
* Attempt to bypass getcwd errors in CI with patch
* Consistently use strings for paths instead of some strings and some pathlib.Path
* Keep pathlib within a function for readability
* fix for ruamel.yaml versions >=0.17.22
* Run poe format
---------
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Add text file that should be ignored to basic test folder journal. Makes tons of tests fail
* Add additional files that should be ignored by FolderJournal
* Ignore all files in folder journal except year/month/day.txt
* Completely remake get_files in FolderJournal:
- move get_files into FolderJournal class and add underscore prefix
- create iterables to get for year/month folders and day files
- make year/month/day file reading strict: only exact expected months and days out of all possible months and days
* Restore accidentally-deleted self.sort() line
* Use match instead of string comparison to be os-agnostic
* Explicitly declare static methods
* Filter with glob first for max performance
* Explicitly check for valid dates in FolderJournal and add unit test
* Remove unneeded jrnl import
* Clean up method comment and add type hints
* Add is_valid_date unit test
* Elucidate comment
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Chore: Update README.md to contribution
Update the contribution link to go directly to the current contribution guide and documentation.
* Update PULL_REQUEST_TEMPLATE.md
* Remove search mode conditional that added explicit tag search behavior
* Fix failing change-time test by using same method signature as base journal class
* Fix user input mock - was not appropriately checking return value
* Clean up controller
- streamline `run` function in `controller.py`
- add debug logging
- fix unnecessary import of Journal class (only needed for typing)
- standardize summary display across different actions
* Add currently-failing test conditions for count messages when changing time and deleting
* Don't show summary if no entries found and prevent extra line break when no entries found by short-circuiting display method
* Track found entry count and remove incorrect modified stat logic
* Track journal entry deletion consistently
* Remove unneeded exception when editor is empty and fix test that was testing incorrect message
* Correct entry edit modified count test
* Track modification of entries with --change-time
* Preserve existing behavior when editor is empty but make the message more clear
* Reconcile tests with new error message when clearing editor in edit mode
* Add found/modified counts to edit tests
* Add tests for found count with -n equivalent argument
* Test combinations of found/deleted messages when using --delete
* Add tests for counting combinations of action arguments (change-time, edit, delete) and for change-time counts. Some are failing and should be investigated
* Remove extraneous comment in test
* Track added/deleted counts in a register in the Journal class instead of attempting to infer it via controller counting
* Add encrypted to more tests
* Fix merge conflict typo
* Change 'write mode' -> 'append mode' in more places
---------
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* update pytest-bdd to 6.0
* update lock file
* fix first test (inject command fixture to request)
* fix some more tests
* fix cli_run fixture
* fix password fixture
* Remove unused import
* Fix greedy should_or_should_not parsing problems while also consolidating its parse/transformation-to-bool code
* Prevent greedy matching in "we run" by using regular expression lookahead
* Add missing "Outline" in scenario outlines with examples
* Split "we use the config" and "we use no config" so pytest won't try to consume config_file as a fixture
* Fix missing ShouldOrShouldNot
* Formatting
* fix get_fixture function
* change output of failing test to be a little more useful
* update lock file
* update type builder to for should/should not to be in it's own file, rename some vars for readability
* add parse-type new dev/testing dependency
* update lock file
---------
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Update front page console examples and feature text with more present-day style, brand-agnostic examples, and hopefully a more inclusive tone
* Updating feature blurb text
* Blurb edit
* Update index.html
* Update index.html
* Update index.html
📓🖉 👍
---------
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Add prompt to ask user if entries should be formatted with colors when installing jrnl
* Use magenta instead of black for default date color
* Use other default colors and alphabetize color list
* Update tests
* Delete test file
* update lock file
* fix failing test after merge conflict
---------
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Add failing test for issue #1493
* Write journal upon creation instead of just creating 0-length file
* Fix test to accommodate current password mocking form
* Use latest mkdocs version 1.4.2
* Add docs_theme to mkdocs watch so it automatically reloads localhost when modifying theme
* Bring in ReadTheDocs breadcrumb theme and fix display issues around "Docs" root breadcrumb
* The problem is CSS, not the breadcrumbs template. Tightly scope offending CSS and remove breadcrumbs template override
* Bring mkdocs ReadTheDocs breadcrumbs theme back in
* Fix pa11y validation issue by replacing breadcrumb a alt attribute with aria-label
* Attribute source of new breadcrumbs file
* Use mkdocs 1.4 or greater with no upper bound
* Document jrnl's temp file behavior when using templates
* Move up "Files in transit from editor to jrnl" section and add notes about template extension behavior in solutions that reference .jrnl extension
* Update privacy-and-security.md
* Add documentation about using Vim/Neovim as editor
* Add documentation about information leaks in editors
* Spelling fix
---------
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* run format
* rename cli.py to main.py
* rename jrnl.py to controller.py
* move journal class files into journals dir
* rename start -> run in controller.py
* Add very basic test template
* Ensure that templates are copied to temporary test workspace
* Add basic template test
* Update copyright for this new file
* Add tag to XML file when edited DayOne entry
* Remove forbidden change
* undo edits
* Tags working for DayOne journal
* Correction doentries to prevent time-error
* Add sorting to tags
* Delete test statements
* Revert time changes
- initial pass through to rework encryption into separate module
- little more cleanup
- rename function, fix some linting issues
- more cleaning
- fix password bug in encryption
- fix linting issue
- more cleanup
- move prompt into prompt.py
- more cleanup
- update the upgrade process for new encryption classes
- general cleanup
- turn into enum instead of strings
- store status code so tests don't fail
- standardize the load and store methods in journals
- get rid of old PlainJournal class
- typing cleanup
- more cleanup
- format
- fix linting issue
- Fix obscure Windows line ending issue with decode
See https://bugs.python.org/issue40863
- fix for python 3.11
- add more typing
- don't use class variables because that's not what we want
- fix more type hints
- jrnlv1 encryption doesn't support encryption anymore (it's deprecated)
- keep logic for password attemps inside the class that uses it
- take out old line of code
- add some more logging
- update logging statements
- clean up logging statements
- run linters
- fix typo
- Fix for new test from develop branch
There was a new test added for re-encrypting a journal. This updates the
refactor to match the old (previously untested) behavior of jrnl.
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* fix issue where changelog is always slightly out of date on release tags
* fix tag step running all the time per CR
* update tag name to use more clear variable name
* add black and isort to flakeheaven
* update lock file
* clean up poe config
* run formta on python blocks in markdown file
* disable code for black being confused about markdown
* add cache timeout for flakeheaven
See: https://github.com/flakeheaven/flakeheaven/issues/71
* Drop Python 3.9 and use Python 3.11 release instead of pre-release
* Run poetry lock
* Fix need for quoted 3.10 string
* Use 3.11.0-rc.2 for Python 3.11 for now
* Update minimum Python version in installation docs
* Change Python 3.11 RC version to 3.11
* Run docs and release workflows on Python 3.11
* Including Python 3.12 in allowable versions
* Restore poetry.lock from develop
* Run poetry lock --no-update
* Retrieve poetry.lock from develop and lock with --no-update
* poetry lock --no-update
* replace flake8 with flakeheaven
* update pyproject.toml for new flake tool
* update lock file
* change flake8 to flakeheaven in tests
* undo fix for poetry
* remove unused plugin marker for flakeheaven
* remove unused import in markdown file
* Attempt to exclude .venv from flakeheaven runs in CI
* Exclude more dirs from flakeheaven
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Describe blocking processes in External Editors page
* Add documentation about how the editor must be a blocking process
* Add contextual link to external editor site
* Point to micro editor as an example since it's likely less intimidating than vim
* rename test config
* Change journal name validation
Journal name validation used to happen before postconfig commands could
have a chance to run, so now each command is responsible for its own
error-checking of the journal name.
Added a new decorator and function that makes this error-checking easier.
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* fix wrapper function call to be more like original
* change arg names to show which aren't used
* add type hints
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Add machine readable --list output
* Refactor list_journals()
Create three new methods for each journal list format.
- JSON, YAML, STDOUT
* Added journal list export test
* Update test regex to handle windows filepaths
* convert bug report from markdown to yaml
* convert feature request from markdown to yaml
* convert documentation template from markdown to yaml
* convert support request template from markdown to yaml
* Suppress "Entry added to default journal" message if using default journal
* Replace "Entry added" BDD test steps with "we should get no error" now that the message is suppressed
* Add positive and negative tests for "Entry added" message behavior
* Added message showing the number of search results
Modified _search_journal() to return a bool based upon whether
any filter args were passed to the program.
Added _print_entries_found_count() which prints a message
based upon the number of entries found and prints warnings
if the user was trying to edit or delete.
* Add tests for search results msgs
* update copyright symbols to unicode
* clean up version screen/copyright notice
* small change to make commands more similar
* update imports to appease isort
* fix test
* update one more file merged since PR was open
* add actionlint for github actions to testing suite
* add quotes around vars per shellcheck
* change expression per shellcheck
* put more quotes around vars per shellcheck
* put quotes around entire string
* use find instead of ls to better handle non-alphanumberic filenames
* update release workflow input types to have actual typese and fix typo
* update docs pipeline to use poe task runner
* move npm dependency into package.json file instead of hardcoding into pipeline
* replace nix-specific call with python version (for windows compat)
* update commands to use python for win compat
* update lock file
* change deps to take out xq and use xmltodict instead
* move script tasks from pyproject into new tasks.py
* run linting on new tasks.py file
* fix typo
* clean up pyproject to make valid toml
* update docs with correct task runner command
* use npx in case node_modules/.bin isn't in the path
* Run pa11y-ci in cross-platform manner (works on Windows)
* Add node_modules to .gitignore
* clean up poe alias
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Add linewrap option 'auto'
* Specify the exception thrown
* Add BDD test
* Specify name instead of number
* Create test for linewrap auto and fancy format
* Fix linewrap auto for fancy format
* Clean up pyproject file
This reduces the differences between local tasks and tasks run in the CI
pipelines
* remove linting step (it's part of test now)
* remove useless arg
* add xdist for parallel test execution in pytest
* Clean up pyproject file
This reduces the differences between local tasks and tasks run in the CI
pipelines
* remove linting step (it's part of test now)
* remove useless arg
* Get rid of `make` in favor of `poe`
This moves the tasks that were previously in Makefile, into
pyproject.toml (with all the other config)
This is also more inclusive of Windows developers since they only need
Python, and no longer have to install make separately.
* update docs
* don't make code blocks also links
* implement tox for testing
* update command to use new task runner
* Get rid of `make` in favor of `poe`
This moves the tasks that were previously in Makefile, into
pyproject.toml (with all the other config)
This is also more inclusive of Windows developers since they only need
Python, and no longer have to install make separately.
* udpate docs
* don't make code blocks also links
* fix missed statement from last PR
* replace print statement for adding an entry to a journal
* clean up linting and format
* change print statement over to new print_msg function
* make print_msg always print to stderr
* change print statement over to new print_msg function
* update importer to use new message function
* update yaml format to use new message function
* code cleanup
* update yaml format to use new message function
* update yaml format to use new exception handling
* update Journal class to use new message function
* update install module to use new message function
* update config module to use new message function
* update upgrade module to properly use new message and exception handling
* fix typo
* update upgrade module to use new message handling
* update welcome message to use new handling
* update upgrade module to use new message handling
* update upgrade module journal summaries to use new message handling
* take out old code
* update upgrade module to use new message handling
* update upgrade module to use new message handling
* update more modules to use new message handling
* take out old comment
* update deprecated_cmd to use new message handling
* update text_exporter with new message handling, get rid of old color constants
* get rid of hardcoded text
* whitespace changes
* rework MsgType into MsgStyle so messages can have different styles
* add comment
* Move around code to separate concerns of each function a bit more
* update create_password and yesno prompt functions for new messaging
* fix missing newline for keyboard interrupts
* fix misc linting
* fix bug with panel titles always showing 'error' after one error
* fix missing import
* update debug output after uncaught exception
* update exception for new exception handling
* rewrite yesno function to use new centralized messages
* reduce the debug output slightly
* clean up print_msgs function
* clean up create_password function
* clean up misc linting
* rename screen_input to hide_input to be more clear
* update encrypted journal prompt to use new messaging functionality
* fix typo in message key
* move rich console into function so we can mock properly
* update password mock to use rich console instead of getpass
* add more helpful output to then step
* fix test by updating expected output
* update message to use new functionality
* rework mocks in test suite for new messaging functionality
* fix linting issue
* fix more tests
* fix more tests
* fix more tests
* fix more tests
* fix merge bug
* update prompt_action_entries to use new messaging functionality
* Add new input_method "type"
This does the same thing as input_method "pipe" but is more clear what
it's doing (typing text into the builtin composer)
* get rid of old commented code
* get rid of unused code
* move some files around
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Fixed error related to display_format in config file
Now _display_search_results tries to source the export arg from the
config file before dispaying search results.
* Add BDD test for original bug
* update unit test
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Check config if FolderJournal and treat as so
* Add test for end of path is slash
* Code format correction
* Requested changes PR 1482
* Add info to doc about path of folder.
* Small addition to doc about folder journal
* Refactored path expansion calls into a new path.py file
This also fixed bugs with relative journal and template paths.
* Update tests for new path functions
Also, make the tests specific to Windows, Mac & Linux
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Implement --change-time flag
* Remove todo from --change-time bdd folder journal tests
* Add warning when --change-time used with no matching entries
* Add a test to make sure running --change-time with nothing prints a warning and doesn't change anything
* Add prompt for --change-time
* Don't prompt for --change-time when used with --edit and only one entry
* When using --edit and --change-time, change the time before editing
* Add test for --change-time used with --edit
* Modify failing --change-time test to conform to text in develop branch
* Added check for empty config file and if so, use default config
* Added check for empty config file and if so, use default config
* Fix and add tests for empty config file
* Exit program with message if config is empty.
bdd-test doesn't add version if file is (and should stay) empty.
* Exit program with message if config is empty.
* bdd-test doesn't add version if file is (and should stay) empty.
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Yaml export errors now don't show stacktrace
* Add test for user-friendly error when exporting YAML to a nonexistent directory
* Leave partially written to files after export error
* unskip working tests
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Attempt to pin jinja requirement to keep readthedocs from failing
* Change read the docs Python version from 3.7 to 3.10
* Unpin jinja and remove deprecated python version setting
* Try pinning to jinja 3.0.3
* Fix "jinja2" (instead of "jinja")
* Update and modularize exception handling
cc #1024#1141
- Stack traces are no longer shown to users unless the --debug flag is
being used
- Errors, warnings, and other messages contain color as needed
- Converted error messages to Enum
- Adds print_msg function to centralize output (this should replace all
other output in other modules)
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* format with black
* add message to catch-all exception block
* Unskip some tests (#1399)
* remove skip_editor test and tag
* remove useless test
* unskip blank input test
* formatting
* rename test so it doesn't overwrite other test
* unskip some dayone tests that now work
* Bump ipython from 7.28.0 to 7.31.1 (#1401)
Bumps [ipython](https://github.com/ipython/ipython) from 7.28.0 to 7.31.1.
- [Release notes](https://github.com/ipython/ipython/releases)
- [Commits](https://github.com/ipython/ipython/compare/7.28.0...7.31.1)
---
updated-dependencies:
- dependency-name: ipython
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Update changelog [ci skip]
* Bump asteval from 0.9.25 to 0.9.26 (#1400)
Bumps [asteval](https://github.com/newville/asteval) from 0.9.25 to 0.9.26.
- [Release notes](https://github.com/newville/asteval/releases)
- [Commits](https://github.com/newville/asteval/compare/0.9.25...0.9.26)
---
updated-dependencies:
- dependency-name: asteval
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Update changelog [ci skip]
* Bump black from 21.12b0 to 22.1.0 (#1404)
* Bump black from 21.12b0 to 22.1.0
Bumps [black](https://github.com/psf/black) from 21.12b0 to 22.1.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/commits/22.1.0)
---
updated-dependencies:
- dependency-name: black
dependency-type: direct:development
...
Signed-off-by: dependabot[bot] <support@github.com>
* Run make format
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Update changelog [ci skip]
* Add reference documentation to docs site and separate out "Tips and Tricks" and "External Editors" from "Recipes" (#1332)
* First draft of command line reference, mostly pulled from help screen
* Add first draft of config file reference, mostly pulled from advanced.md
* Clean up config file doc for readability
* Add --config-file and remove examples from CLI reference
* Add warning about time zone in timeformat
* More small changes, and adding template config keyword
* Cleaning up and re-ordering config file reference
* Clean up reference and anything else from advanced documentation that can live elsewhere and linking to config file reference wherever config file is mentioned
* Fix syntax highlighting in command line reference, clean up content a bit, include --diagnostic
* Mention version config key
* Apply minor changes suggested in PR review
* Rename "recipes" to "Tips and Tricks", pull "External Editors" out of it into its own page, and redirect old recipes link to tips-and-tricks
* Revert broken mkdocs-redirects usage from last commit
* Update changelog [ci skip]
* Add --co alias for --config-override (#1397)
* Add hash as a default tag symbol (#1398)
* Update changelog [ci skip]
* Increment version to v2.8.4-beta2
* Update changelog [ci skip]
* Increment version to v2.8.4
* Update changelog [ci skip]
* Bump pytest from 6.2.5 to 7.0.0 (#1407)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.0.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.0.0)
---
updated-dependencies:
- dependency-name: pytest
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Update changelog [ci skip]
* Drop support for Python 3.7 and 3.8 (#1412)
* Remove Python 3.7 and 3.8 from github actions workflows
* Update lockfile after running poetry update a couple times
* Update poetry lock
* Remove Python 3.7 and 3.8 from pyproject.toml and run poetry lock
* Update changelog [ci skip]
* Tidy up git ignore (#1414)
* cleaned gitignore and add comments
* removed colon for readbility
* alphabetize files in sections
Co-authored-by: nelnog <nel.nogales@gmail.com>
* fix behavior that was confusing pytest
* update test to match new message
* whitespace change
* clean up error for manually stopping the inline editor
* udpate error to use new exception handling
* move some exceptions and errors to the new exception handling
* add line breaks to keyboard interrupt so it looks more like other exceptions
* add handling for exceptions that happen earlier in the flow
* add new 'NothingToDelete' error to replace old behavior
* get rid of old exception
* add new exception handling to 'nothing saved to file' errors
* move exception for no editor configured into new handling
* move exception for no alt config to new handling
* get rid of old exception handling for encrypted journal
* Move error for too many wrong passwords into new handling
* fix merge errors
* replace sys.exit call with new exception handling
* replace sys.exit call with new exception handling
* replace sys.exit call with new exception handling
* reformat with black
* clean up old code
* clean up old code
* clean up linting issue
* update uncaught exception for new handling
* update test
* fix mangled lock file
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jrnl Bot <jrnl.bot@gmail.com>
Co-authored-by: Nelson <35701520+nelnog@users.noreply.github.com>
Co-authored-by: nelnog <nel.nogales@gmail.com>
* Remove Python 3.7 and 3.8 from github actions workflows
* Update lockfile after running poetry update a couple times
* Update poetry lock
* Remove Python 3.7 and 3.8 from pyproject.toml and run poetry lock
* Switch from pyyaml to ruamel.yaml
* Remove duplicate editor key in config
* Use ruamel.yaml instead of pyyaml in legacy template.py
* Prevent ruamel from collapsing config YAML
* Run make format
* fix test failing because tomorrow is daylight savings
* add test for newly discovered daylight savings issue (and skip for now)
* whitespace change
* update title of test
* fix copypasta
* Update and modularize exception handling
cc #1024#1141
- Stack traces are no longer shown to users unless the --debug flag is
being used
- Errors, warnings, and other messages contain color as needed
- Converted error messages to Enum
- Adds print_msg function to centralize output (this should replace all
other output in other modules)
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Remove Python 3.7 and 3.8 from github actions workflows
* Update lockfile after running poetry update a couple times
* Update poetry lock
* Remove Python 3.7 and 3.8 from pyproject.toml and run poetry lock
* First draft of command line reference, mostly pulled from help screen
* Add first draft of config file reference, mostly pulled from advanced.md
* Clean up config file doc for readability
* Add --config-file and remove examples from CLI reference
* Add warning about time zone in timeformat
* More small changes, and adding template config keyword
* Cleaning up and re-ordering config file reference
* Clean up reference and anything else from advanced documentation that can live elsewhere and linking to config file reference wherever config file is mentioned
* Fix syntax highlighting in command line reference, clean up content a bit, include --diagnostic
* Mention version config key
* Apply minor changes suggested in PR review
* Rename "recipes" to "Tips and Tricks", pull "External Editors" out of it into its own page, and redirect old recipes link to tips-and-tricks
* Revert broken mkdocs-redirects usage from last commit
* remove skip_editor test and tag
* remove useless test
* unskip blank input test
* formatting
* rename test so it doesn't overwrite other test
* unskip some dayone tests that now work
* Add weekly Saturday morning build and prevent Python 3.11 from running on PRs
* Fix extraneous greater than symbol
* Add branches and paths to cron schedule
* Add back missing hyphen before cron
* Trying to fix YAML syntax error
* Remove branches and paths from schedule
* Fix invalid conditional, push 3.11 check down to actual tests like we did with 3.10
* Separate out PR tests and scheduled tests
* Fix YAML syntax
* Fix uses action reference
* Use proper action folder structure
* Check out repo before running local action
* Specify bash shell and remove unneeded if
* Specify shell for each run statement
* Move secret out of composite action since it is not supported directly
* Fix half-fixed previous commit
* Remove extraneous ./
* Fix pathing and name steps
* take out shell key from action
* put back missing git config line in workflows
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* WIP
* fix handling of user input (stdin, input, getpass)
* take out redundant pytest step
* fix handling of 'we should' statements
* fix test that doesn't use a config file
* fix another test that uses stdin
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* remove .tool-versions file per PR feedback
* add comment to clarify why disembodied variables are here
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Add added option to _print_edited_summary
* Add tests for counts of entries added, modified, and deleted
* Add test for modifying an entry rather than replacing it
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Remove special case code needed for Python 3.10 pre-release and try to get Python 3.11 pre-release running on CI
* Wrap 3.10 in quotes so it doesn't resolve to 3.1
* Remove pflake --version call that is crashing in Python 3.11-dev
* Run poetry update and restore removed flake8 line
* added new CLI argument option --config-file
* pass argument and fetch alt config file if specified
* argparse argument setting update
* argument alias --cf added
* documentation update - usage of CLI argument
* fixed name-clash + unit tests
* feature test added
* #1170-alternate-config-file: Auto stash before rebase of "refs/heads/#1170-alternate-config-file"
* Update docs/advanced.md
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* BDD tests added
* Begin migrating/rewording --cf tests in pytest-bdd.
Uses current directory instead of deep directory structure, but requires a given for each config file referenced
* Fix issue where specifying a config-file that needs to be upgraded ended up upgrading the user config file instead
* Uncomment and rework remaining tests for pytest-bdd instead of behave
* Fix copytree for Python 3.7 (which doesn't support dirs_exist_ok)
* Minor fixes to alternative config examples
* Remove behave tests (behave is no longer in use)
* Move config file unit test to unit test dir and use pytext path fixture instead of current directory to find test data
* Use explicit "given the config exists" for copying config files instead of shoehorning in "given we use the config" twice
* Change when/when to when/and
* Clarify scenarios and fix indentation
* Confirm primary config file isn't modified when encrypting/decrypting a journal in an alternate config file
* Remove try/except on copytree since I'm no longer using the same
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Initial migration of contributing.md to docs site
* Update contributing to include pytest-bdd changes
* add top level section support, and h2 support in sidebar
* Incorporate latest changes to contributing.md, clean up language and formatting, and check/add links as necessary
* Add a link to milestones
* Update CONTRIBUTING.md
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Added Recipe for visualizing Markdown in the CLI, fixed some typos and added backticks in all references of jrnl
* mdless recipe changes during review
-condense language
-make it sound less like an endorsement
-add link about less
-minor grammatical change
Co-authored-by: Fidel H Viegas <me@fidelhviegas.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* update yaml loader to new method
* Add config overrides steps to pytest
This requires some patching around the config object, which now happens
in every test.
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* udpate docs for new tests
* remove behave from deps
* remove feature dir from flake8 checks
* udpate lock file
* disable pip version check (it keeps spamming the pipeline)
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* add newer tests to pytest (from behave)
* remove 'lib' from gitignore (since we're using it)
* fix capitalization in some steps
* add 'the editor should not have been called' step
* comment out config override step in pytest-bdd since it's not implemented yet
* remove test that didn't really test anything
* implement some missing steps in pytest-bdd
* change comment to match other tests
* Add docs section for journal types
* Include new journal types docs section in site nav
* Add section on changing a journal type and clean up work from previous commit
* Re-enable failing folder/DayOne tests
* Disable dayone tests again - out of scope for this problem
* Fix folder journal deletion by tracking which dates are associated with deleted entries
* Raise exception when trying to commit folder-based journal (including DayOne)
* Change negative bool name to a positive
* Add test to ensure this doesn't mess with encrypting normal journals
* Consolidate and standardized tests
* Add failing test for new error message about unencryptable journals
* Warn when encrypt is true and journal type is directory/DayOne
* Re-enable failing directory journal import tests
* Appropriately track journal name and modified entries in FolderJournal when importing
* Run make format
* Raise exception when trying to commit folder-based journal (including DayOne)
* Add test to ensure this doesn't mess with encrypting normal journals
* Consolidate and standardized tests
* Add Python 3.10 support
* Change Python 3.10 to 3.10-dev in CI
* Run poetry update
* Turn off fail-fast to troubleshoot
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* Add continue-on-error for 3.10
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* use prerelease poetry for prerelease python
* fix syntax error
* rename steps to make more sense
* remove dev dependency that breaks with python 3.10
* update tests
* Change test dependencies for minimal breakage on python 3.10
- loosen the test dep requirements (so we get warned about these
problems sooner)
- add new extras group to provide minimal deps required for testing (we
don't need to run static analysis again on every version)
* change how we check if deps are installed so test don't run wild
* add setuptools due to poetry bug, clean up other steps
* update lock file
* test
* Revert "test"
This reverts commit 31e538300e.
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
Now that all the tests are passing, this breaks them up into a few
different files to make everything more organized.
Note: Pyflakes is complaining about some unused import statements.
- Misc linting issues
- Whitespace cleanup
- Entire test suite is now passing
- Add misc todo items in comments
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Take out old type coersion (it was causing needles complexity)
- Take out `read_value_from_string` function
- Use taml parser to parse yaml instead of using custom function
- Update tests to use new implementation
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Implement mock editor fixture
- Add fixture to keep track of editor state
- Implement various steps to check editor state
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Implement cache dir fixture and step
- Implement various steps to check the cache directory (files contained,
etc)
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Use regex parser in pytest-bdd to support "we run" steps that also
have user input ("and enter")
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Handling should and should not like this should reduce the amount of
fixtures we need for the test suite
- Add more password tests
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Fix some input handling in steps (especially for passwords)
- Fix some formatting issues
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Scaffold some tests that will be added later
- Add fixtures for journal name and keyring type
- Add "we should be prompted for a password" step
- Add "we should not be prompted for a password" step
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Implement TestKeyring
- Implement NoKeyring
- Implement FailedKeyring
- Copy in `read_value_from_string` function from old tests (will
probably rewrite this later)
- Add fixtures for keyrings
- Implement "we have a keyring" step
- Implement step to check specific config values for tests
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Makefile no longer runs on virtual env modules
- Update some function names so pyflakes doesn't error
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Add some necessary fixtures
- Add datetime test
- Implement "the output should not contain" step
- Implement "the output should contain the date" step
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Allow config step to support scenario outlines
- Add another datetime test
- Get rid of read journal step since it doesn't work with other journal
types (we should rely on jrnl knowing how to parse each jrnl type for
better tests)
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This will prevent any unexpected files from showing up anywhere outside
the temp dir
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Deletes most of the datetime tests so that they can be
re-added as they are implemented in pytest-bdd
- Implements steps that check the journal and output for strings
- Get rid of deployment tag (we're not using it, anyway)
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
Pytest-bdd uses fixtures to handle most things. This makes a fixture
that will create a temp directory for the tests to run in.
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
- Copy over the current tests from behave into the new directory that
pytest-bdd will use them in
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
Homebrew doesn't like explicitly declaring a version for a formula (it
prefers to infer it from the url), and will throw an error on PRs. So,
this removes that part of the workflow.
* behavior outline
* enforce positive initial linewrap
Check column widths
update gitignore
throw error when linewrap too small
simply check for large enough linewrap value
* delete unused error message
* PR feedback
make exception more informative
update check_linewrap signature in src and test
make check_linewrap a free function
* delete unused function
* delete else..pass block
* newline for make format
There were several problems that this fixes:
- shallow fetch broke merging to release branch
- bad changelog was only outputting error msg (not exiting)
- latest version being on first line deleted itself and broke the
changelog updates
This also has manual fixes to the changelog to bring it up to date.
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Add homebrew symlink for releases
* Fix indentation problem
* Fix bad env var name
* Change filename to formula name
* Fix formula name
* Attempt tap instead of symlink
* Fix formula repo referece
* add tracer
* Attempt working directory fix
* Remove --unshallow
* Use token for remote
* Move set tap directory step
* Remove tracer
* Clean up spacing and wrap quotes to tap directory
Add --config-override feature
* add test and argument handler for runtime override of configurations.
* identify location to apply override in "main"
* update gitignore
* remove unneeded import
* add jrnl interface test for overriden configurations
* trivial whitespace change
* implement runtime override
* make format
* refactor override unittest
* clean up unused import
* start writing integration test
* add linewrap override scenario
* implement editor override step
* add dev dependencies on pytest -mock and -cov
* make format
* remove unused imports
* make format
* rename --override to --config-override
* move override implementation into own module
* begin TDD of dot notated overrides
* rewrite behavior scenario
* implement recursive config overrides
* clean up unittests
* iterate on behave step
* make format
* cleanup
* move override behave tests out of core
* refactor recursive code
* make format
* code cleanup
* remove unused import
* update test config
* rewrite test for better mock call expect
* make format
* binary search misbehaving windows test
* unittest multiple overrides
* uncomment dot notation unittest
* add multiple override scenario spec
* make format
* make format
* update unittests for new syntax
* update integ tests for new syntax
* update gitignore
* guard override application
* deserialize function as return type
* make format
* organize deserialization unittests
* better, more specific behave tests
* test different editor launch commands
* formatting
* handle datatypes in deserialization and update helptext
* stick to config convention in testbed
* update tests ith better verifications
* make format
* space
* review feedbac
* make format
* skip on win
* update deps
* update tests with better verifications
make format
space
review feedbac
* skip on win
* update deps
* refactor deserialization
organize test_parse_args
make format
* skip on win
* refactor deserialization
organize test_parse_args
make format
* update tests ith better verifications
* make format
* space
* make format
* document apply_overrides
* update gitignore
* document config-override enhancement
* Simplify config override syntax (#5)
* update tests and expected behavior
* clean up arg parsing tests
* update deserialization
* update deserialization
* config argparse action
* update override application logic
* update tests; delete unused imports
* override param must be list
* update docstring
* update test input to SUT
* update remaining override unittests
* make format
* forgot to update CLI syntax
* update documentation to sphinx style
* variable renames
* Lockfile merge (#7)
* Add brew and gitter badges to README
* Update changelog [ci skip]
* Make journal selection behavior more consistent when there's a colon with no date (#1164)
* Simplify config override syntax (#8)
* update tests and expected behavior
* clean up arg parsing tests
* update deserialization
* update deserialization
* config argparse action
* update override application logic
* update tests; delete unused imports
* override param must be list
* update docstring
* update test input to SUT
* update remaining override unittests
* make format
* forgot to update CLI syntax
* formatting
* Update pyproject.toml
* update lockfile to remove pytest-cov and pytest-mock deps
* update docs
* reuse existing mock; delete unneeded code
* move overrides earlier in the execution
use existing configs instead of custom
make format
clean up imports
* update for passworded access
context.parser -> parsed_args
* test that no editor is launched
* remove unnecessary mocks
* rename variable for intent
* reinstate getpass deletion
* update gitignore
* capture failure mode
* remove unneeded imports
* renamed variable
* delete redundant step
* comment on step
* clean up step behavior description
* [WIP] lock down journal access behavior
* skip -> wip
* correct command for overriding journal via dot keys
* update wip test for updating a "temp" journal and then reading baack its entries
* remove "mock" from poetry file
* make CI happy
* complex behavior sequence for default journal override
* separate out smaller pieces of logic
test that apply_overrides acts on base configuration and not the copy
* defer modification of loaded configuration to update_config
remove unused fixtures
delete complicated UT since behavior is covered in overrides.feature integ test
delete redundant UT
* Update .gitignore
* remove skip_win
* forward override unpacking to yaml library
* merge config override step with existing config_var step in core
delete config_override step
unify step description syntax
* delete unused and redundant code
* rebases are hard
* remove wip tag from test
* remove skipped tests for windows
* Address code review
yield -> return
remove needless copy
adjust spacing
re-inline args return
reset packaging info to e6c0a16342
revert package version for this PR
* consolidate imports
* Defer config_override unpacking to dict *after* base config is loaded
store cli overrides without unpacking just yet
move deserialize_config_args to config module
delete custom Action class for config operations
apply [k,v] -> {k, v} for each override
update test data
update import
* rename deserialize_config_args to better express intent
make format
* Fix inverted POSIX check, refactor os_compat, and add tests for it
* Fix missing parentheses and remove skip_win on test that is passing in Windows now
* Fix expected quotes in quoted args
* Make output clearer on failing test
* Bringing skip_win back to test whose failure is a bit more complicated than expected
* Introduce -reminisce, -month, -day, and -year
* Update expected_args in parse_args tests
* Add check before creating compare_d
* Misc changes
* Implement testing for -month, -day, -year, and -reminisce
* Compress tests into one Scenario Outline
* Fix failing tests by updating dates_similar journal
* Create 'we set current date and time to' step
* Use time.parse in reminisce
* Update dates_similar journal
* Make 'Searching in a journal' test shorter
* Lint
* Implement reminiscing test
* Add combination tests
* Finalize tests
* Finalize pytests
* Simplify reminisce tests
* Change reminsice help (since it also shows today's entries)
* Re-do tests; use various tests
* Remove old test data
* Better scenario description
* Standardize format for compare_d
* Rename -reminisce to -today-in-history
* Create datecount plugin
* Fix plugin import
* Update datecount format
* Create datecount test
* Remove outdated comment
* Remove unnecessary datecount export condition
* Update test config
* Move get_date_counts into DateCountExporter; misc changes
* Use --format instead of --export in datecount test
* Update datecount test to include configs
* Better datecount test
* Remove old tests
* Change 'datecounts' to 'dates'
As a beginner in Python it wasn't clear that `poetry install` needed to be run before `make test` for instance. That threw a sort of obscure error until I figured it out what the solution was. This is extremely minor, but make sure installing dependencies is the very first instruction can reduce some friction when contributing.
* Moving configuration values and methods from install.py to config.py -- everything is broken right now
* Using context to store config path - still lots broken
* Use mocks and context.config_path to store test configs - many tests still broken though
* Update changelog [ci skip]
* Fix jrnl --ls crash
* Fix crash when no editor configured
* Attempt to patch config path with test data - doesn't appear to be working
* Properly use patched config path and add config given to scenario that wasn't using it
* Fix copypasta
* Fix editor test that needed patched config and trapping for system exit
* Add exception and handling for when configuration directory is actually a file
* Remove extraneous comment
* Use more generic JrnlError with messaging switchboard
* Format code a bit nicer
* Remove unnecessary given in diagnostic test
* Ensure full error message is output
* Remove unnecessary whitespace characters
* Create tests and steps for temporary filename suffix
* Have temporary filename suffix be -{template_filename} or .jrnl
* Finalize extension_editor_file
* Make suffix local variable in get_text_from_editor
* Fixes for search on docs site
We previously didn't include the search results page in our CI testing,
so we missed some issues on that page. This ensures that page is part of
regular testing, and also includes fixes for the issues present.
* fix sidebar contrast
* add background-color as fallback for gradients on docs site
This is both for old browser support, and for accessibility. Some
accessibility tools turn off gradients since they can make text hard to
read for those with visual impairment.
* change mobile header color for docs site
The mobile header was using a light-purple to dark-purple gradient, even
though every other gradient on the site is mid-purple to dark-purple.
This commit changes that both for consistency on the site, and because
light-purple causes an accessibility issue with the white text in the
header (even though the accessibility tools don't notice because of the
gradient).
* Fix version header detection in changelog
This updates the regex to find the version header in our changelog.
There was a bug that affected patch, alpha, and beta versions. For
example, if we were looking for "v2.5" we might find "v2.5.1" or
"v2.5.1-alpha" or other versions like that.
This led to the changelog not being cleared properly on update, and old
versions sticking around longer than they should.
* re-add option to include author link for merged PRs in changelog
This option was accidentally left out when migrating the changelog
generator tool to github actions.
* fix conditional in changelog workflow
In github actions, booleans always end up as strings. So, it's not
enough to test `env.FULL_RELEASE` because both 'true' and 'false' will
evaluate as true. This fixes the conditional to check for the string
value 'true' instead of relying on a boolean.
* Update authors to "jrnl contributors" to comply with GPL3
* Include jrnl email address with contributors
* Include GPL notice in jrnl --version
* Apply consistent copyright and license to all Python files
* Add copyright and license to documentation
* Add copyright and license to docs theme
* Wiping poetry cache to try to resolve a test issue
* Testing with Python 3.9.0 in attempt to bypass GitHub Actions failure in 3.9.1
* make format
* Exclude Windows Python 3.9 build which is failing due to a GitHub Actions problem
* Modify testing to get around this 3.9 issue...
* Fix exclude
* remove old file that was only needed for gh-pages
* fix broken icons on docs home page
* add more contrast to twitter button hover state
* tweak non-accessible color to meet standard
* tweak non-accessible colors to meet standard
This new job will submit a PR to the relevant upstream repo as part of
the release workflow.
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
The changelog was triggering after each branch create on a repo. That
doesn't happen often on the main repo, but does happen often on
contributor forks. This should stop the rampant GH actions.
The previous plugin looked nice with the comments and annotations, but
apparently doesn't work for PRs. It can only run on the pr target (our
branch), which means that the tests are never actually run against the
new code.
As you can guess, this is pretty useless for PRs. So, this PR fixes
that, and uses the very nice pa11y-ci (instead of the normal pa11y).
While it doesn't upload annotations, the output is very readable and
seems like the best we're going to get.
Look, this might me my least ambitious commit ever, but having mismatched parentheses has crashed the internet before, so let's rather be safe than sorry!
This also unpins versions of some dependencies where the API is very
stable, or pinning wasn't getting us any additional stability.
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* add some attribtutes to docs template for accessbility
* fix colors to meet accessibility guidelines (4.5 contrast ratio for text)
* Fix last remaining pa11y error (no button on search form)
This fix required moving the mkdocs theme out of the docs directory.
It's no in the docs_theme directory, and the mkdocs config is updated
accordingly.
* Re-enable accessibility testing for docs sit
Also, move the pa11y script into the gh actions workflow
* clean up linting issues in css
* fix and standardize link colors across site
* fix twitter button opacity making text fail contrast requirements
* move buttons on docs site index nav, tweak font weights
* fix footer opacity, tweak spacing of the now more visible sections of the page
* change font sizes on index page to meet WCAG
* udpate font sizes site-wide for accessibility
* fix sidebar for accessibility (font sizes and color contrasts)
* restyle code blocks to have dark background, and meet accessibility requirements
* standardize (accessible) colors across docs site
* Fixes for new CI pipeline (Github Actions)
- Support ci skip tag on commits to avoid build dupes
- Add smarter path detection so we don't spam tons of tests
- Allow steps to cancel if previous steps were cancelled (don't always
run)
- Separate workflows to be more modular
- Update release workflow to do a few more things
- Add helpful messages
- Be more strict in version checking (now with added regex)
- Make changelog smarter about when to trigger
- Add some functionality for changelog to handle releases and
prereleases separately
- Better error handling
- Split up the version validation and the release to make way for more
releases
* add step in workflow to merge to release branch after a release
* add check for git diff so commit doesn't error out constantly
* add bot token since gh actions doesn't allow pushing to protected branch
* add a max for issues, since we keep getting rate limited
* add jrnl bot username to commit step
* change token for git repo
* Add changelog workflow to github actions, remove old script
This basically takes the exact script, and turns it into a workflow. The
only difference is that the new workflow doesn't detect a release build
like the script did (releases will be a separate workflow).
* remove old config file for changelog generator (it's in workflow now)
* whitespace change
* remove ableist language
* Add initial config to test github actions
* remove other CI configs so PR doesn't get bogged down
* add poetry
* skip failing test, update behave output
* add multiple python versions
* add test cache
* try to use matrix for python version
* try to cache pip installation
* add other OSes
* whitespace changes
* skip failing test on windows
* add pip cache
* take out pip cache
* clean up, add linting steps
* add release branch to testing
* clean up
* add initial a11y config for docs site
* take out junit for now
* add junit annotations
* try different junit reporter
* add junit annotations into same workflow
* linter fix
* make junit step always run
* more junit
* clean up
* disable a11y exit code for now (always pass)
* put back travis and circle so we can temporarily run everything in tandem
* fix for issues with secret tokens
* Update version pin on pyxdg and run poetry update
* Update pytest pin and rerun poetry update
* Update black pin to latest version, poetry update, and make format
* Add circle ci config file for linux tests
* Moved repeated commands into commands section for reuse in jobs
Circle apparently allows you to separate custom commands into their own
key, and then reuse them at will in jobs.
* move conditions into individual commands
* Applying doc changes based on reviews of past several documentation PRs
* Update docs
Clean up encryption docs
Clean up security docs
Delete export.md
Make new formats.md and add to sidebar. Also add all of the built-in formats, and examples for each.
Update mkdocs config for new files
* Fix broken docs links
* Correct incomplete sentences and markdown formatting issues
* Make overview a little more concise
* Update some command line arguments to latest version and make it a bit more concise
* Clean up unneeded TOML modifications and other scaffolding not needed for 3.9
* Revert "Clean up unneeded TOML modifications and other scaffolding not needed for 3.9"
This reverts commit 13b4266ed1.
* Specify that brew is also the easiest way to install jrnl on Linux
* Update docs/security.md
* Update docs/recipes.md
* Doc updates:
- Remove import/export page, fold it into formats
- Rename security to privacy-and-security.md to avoid conflation w/ github security issues
- Various small cleanup and edits from PR review
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* make behave slightly less verbose for use with behave --format progress2
* standardize behave tests
* move tests around to be more behavior driven
* clean up txt file after tests
* add more tests, add more functionality to behave for calling mock editor
* move around behave tests, get rid of regression files
* clean up some code around keyrings
* add more placeholder test scenarios (marked with @todo)
You can run just these tests with `behave --no-skipped --tags=todo`
* fix "missing_directory" test
This test was missing the config file it was trying to use. So, it was
really a very useless, broken test that we absolutely should not have
approved the PR (#963) for.
* add write tests for each journal type
* update version tests, add new regex match behave step
* add config test outlines
* add journal types to some search tests
* change "basic" config reference to "simple"
* update configs
* add more journal types in search
* fix basic folder journal reference
* add flush output steps to behave, update delete flag tests
* fix failing test with a flush
* update more delete flag tests to include other journal types
* fix file cleanup after failed test with no debug on
* fix password test
* fix DayOne tag sample data, move search/format tag tests, and run them on multiple jrnl types
* added ability to auto-prompt for password for encrypted journals
Only uses password when prompted, and doesn't get in the way of other
input prompts. This allows us to run the same scenarios on both
encrypted journals and other journal types.
* fold encrypted scenarios into the rest of the scenarios where possible
* remove apostrophe that is breaking tests on CI
* add more journal type tests to import feature
* standardize whitespace in behave tests, take out duplicate test
* update handling of cache directories in test suite (easier syntax)
* skip failing YAML exporter emoji test on Windows
* added @todo tags for things that need follow-up
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* Support Python 3.9 release in build instead of using 3.9 beta
* Revert Linux and Mac 3.9 definitions since release versions are not working on either
* Run poetry update
* Try out Python 3.10 support on all platforms with allow_failures on
* Adding c:\Python310 path reference for Python 3.10 Windows build
* Clean up unnecessary TOML modification in 3.9 build and always upgrade pyenv in Mac builds
* Clean up unnecessary before_install step on Mac and change 3.9-dev->3.9 definition on Linux
* Reverting Linux Python version to 3.9-dev so that it will run
* disable logging by default (only enabled if --debug flag is given)
* Run make format
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
The terminal now overlaps the header (the purple area at the top of the
page) and the main area (the white area underneath). This draws more
focus to it, and quite literally puts the terminal front and center.
This also fixes a few typos, and updates the commands in the terminal to
match jrnl v2.5 updates.
* updated README.md:
- corrected information about encryption
- made additions based on proposed changes to overview.md
- made other changes for clarity and grammar
* ongoing changes to overview.md
* added note that `pycrypto` is required
made other small changes for grammar and clarity
* added new python decryption script to encryption.md
* updated encryption.md to clarify dependencies
other relatively small changes for clarity
straightened quotes
Co-authored-by: Guy B. deBros <guydebros@users.noreply.github.com>
* 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>
* First stab at adding Python 3.9 dev Travis builds
* Dynamically replace Python max version for Python 3.9 beta builds
* Fix allow_failures (3.9-dev, not 3.9) and fix Windows find-and-replace command to allow 3.9
* Fix allow_failures to allow all three Python 3.9 builds to fail
* Use platform-independent Python script to allow all Python versions for 3.9 builds
* Format changes and changing before_install to script for 3.9 builds
* Install toml module to make it possible to run version-changing script before install
* Properly populate before_install step with Mac and Windows Python 3.9, and remove extraneous unused python key
* Add refreshenv to get python3 path included in WIndows
* Ensure MacOS pyenv is up to date and attempt to reference Windows python3 directly
* Use bash-friendly paths in Windows and check to see exactly what the Python 3.9 executable is
* Confirm Python version in Windows and attempt to get pip a different way
* Fiddling with Windows python references
* Remove Python3.6 references and check for Python directory in root directory
* Add Python 3.9 path to Windows build
* Remove pip steps that should be unnecessary
* Add upgrade pip to Windows Python 3.9 build
* Attempt to resolve "access denied" error when upgrading pip on Windows
* Use allow_all_python_version TOML script in nightly build instead of sed
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.
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.
Also, cleaned up the way the arg parser handles standalone commands.
Rather than checking individually for each command, you can now register
the command in the proper place, and it will be run with all known
arguments (and cofig if available).
* add missing dependency
* update cryptography dependency
* Installing poetry with pipx instead of pip
* Fix bad pipx install command
* Remove pipx commands and attempt to solve issue through poetry configuration
* Fix pip install command to include --upgrade as before
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* 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>
* 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
It's not our main branch anyway, and "release" makes it more clear what
it's for. There's an industry-wide trend to move away from terms that
invoke master/slave relationships in order to make members of
marginalized populations slightly less uncomfortable.
* Extensive modifications to overview.md.
I tried to add clarity and details while maintaining the spirit of the original
document. However, it might be a bit too 'dry' now. I'd be happy to liven it up
a bit. I'm only serious when I feel like I _have_ to be.
One of my opinions (which may be at odds with yours) is that the documentation
should emphasize `jrnl`'s advantages without downplaying any other existing
solutions.
If I have time, I'd like to add more information about the documented benefits
of journaling, particularly the mental health aspects. That will probably need
its own page, but I'm new here, so I don't want to overstay my welcome. :)
* More changes to overview.md in response to feedback
"why keep a journal" section removed -- it could be re-added as its own page,
but it's not front-page material
* More changes to overview.md:
- fixed up the headings
- added information about multi-platform support
This is a work in progress and _not_ ready for prime-time.
- need to add to Command-Line Interface section, among other things
* More changes to overview.md:
- moved "`jrnl` is a simple..." to "Command-Line Interface" section
* 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>
* 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
* Cleaned up usage.md for clarity, formatting, and grammar.
While working on it, I hard-wrapped the lines to 80 characters. Hope that doesn't complicate things.
Note: I changed the Steve Buscemi quote to maintain compliance with the Code of Conduct.
* more changes to the usage page
Includes information about two new functions (`--delete`) and (`-contains`).
It's starting to look quite different from the original...
* 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
* ask for password before adding entry (#799)
This fixes#799 because previously it would allow you to create an
entry using your editor and then attempt to open the journal. This
behaviour is fine for unencrypted journals but with encrypted journals
it means that if you get the password wrong three times then the entry
you just wrote is lost.
Swapping the order around so that the entry is opened first in the code
and then the editor is added means that this can't happen.
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>
* Prevent filtered deletion from deleting entire journal #932 and add lots of deletion tests
* Undo removal of deletion feature
* Use more performant deletion
* Improve GitHub PR Template
* suggest running commands with `poetry run ...`
pyflakes here is given only certain subdirectories because `.` will try and run across all packages installed in the virtual environment, if the virtual environment is within the project's root folder (which is my common practice).
The MIT license is a bit outdated, and doesn't provide the protections
we'd like in a modern open-source application.
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
* [Travis] update Windows Python versions
* Update Python versions to be uniform across the board
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
* [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>
* [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`
The API of the standard library's `plistlib` changed with version 3.4 of Python, and the old API is being removed in Python 3.9. In other words, the new API is supported by all version of Python we current support (3.6 to 3.8).
See https://docs.python.org/3.4/library/plistlib.html for more details.
Poetry errors out if we try to run a different version of Python that
what is specified in the config file. We want to run tests against the
latest Python version so we can see problems before they happen. This
fix updates the config file so Poetry will allow us to test. Nothing is
committed after the update.
* 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>
* Include information about branching strategy
* Re-organize documentation and include information on testing
* Use gerund form in Contributing headlines
* Fix markdown links and expand developing documentation
* Add pipx link and explain test code structure
* Include pull request process in CONTRIBUTING
* Update CONTRIBUTING with small changes from PR review
* Mention failing tests in CONTRIBUTING
* Add information for developers about issue labels
* 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
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
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.
Taking out these lines earlier fixed the homebrew release, but broke
other things. So, I'm putting them back for now until we can find a
better solution.
These kinds of jokes make us look bad, and have gotten this project bad
PR on social media. It's best to get rid of them. We can still be super
glib and funny without crass jokes.
* 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...
* [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`
Getting ready to implement the auto-changelog generator is easier if we
are caught up with the old changes. This was generated by running the
generator locally.
Co-authored-by: Micah Jerome Ellison <git@micahjero.me>
[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
This commit should greatly simplify all password handling logic. No passwords are stored in the config dict anymore. Only the Encrypted Journals have any password related logic. I also had to remove some password fields from the test files, which shows how dangerous the previous approach was. A slight code change could've leaked passwords to the config file. However, I had to change the install progress a little bit to make this work. It will now not ask you for a password right away but rather if you want to encrypt or not. Only if you reply 'y' will it ask you for the password later on.
See #739 (Python 3.8), #619 (Windows)
Appease the Travis gods
[Travis] no auto-ruby
[Travis] include a test in not UTC
see #742
[Travis] Add Python to PATH on Windows
[Travis] Windows: try Python 3.7 for cryptography wheels?
[Travis] Windows tests time out
Add test for aborting jrnl entry from editor
Use native mocking
Add comment explaining discrepancy between expected and asserted output
Fix check_empty_output method
Check message on stderr and patch subprocess.call
Add _mock_editor_function
Update features/steps/core.py
Add return from mock function
Add debug statements
Debug
Update features/steps/core.py
Move sys.exit() down
Fix test?
Fix test?
Fix test?
Clean up debug statements
Clean up debug statements
Remove extraneous code
Remove extra space
Add test for empty stdin input
Remove extra debug line
Fix test?
Fix test?
Update features/core.feature
Fix test?
Fix no stdin input test
Co-Authored-By: pspeter <peter.schmidb@gmail.com>
c.f. commit 7cbca9f60f
c.f. commit 398283a8db3177b1ae122e5b9d6a9d623cf9106f
[Dayone] Skip failing tests on Travis
Travis sets the timezone to UTC, which causes many tests to fail
Ever since version 2.0, when parsing a journal file, jrnl would not use
the custom date format string anymore. Instead, it relied on the
dateutil library to get the parsing right. This change was made to allow
people to change their date format without having to manually change
their file. However, this broke some existing date formats like
%d.%m.%Y, as it would falsely interpret the month as day and vice versa.
This commit adds some tests to catch this error and fixes it by trying
to parse the dates using the custom format first, only falling back to
dateutil when needed.
fstring wip
Run pyupgrade
fix broken pyupgrade fstring
run pyupgrade on plugin dir
fixup! remove py2 remnants and use mocks in tests
small print bugfix
The file=sys.stderr was part of the format(), so an error got printed to
stdout
Drop use of codecs package
Use builtins.open() instead
fixup! remove py2 remnants and use mocks in tests
The poetry version command will change in poetry 1.0 (see sdispater/poetry#1191). Without any argument, it won't bump the version anymore but instead just print the current version. This will break the current travis before_install. Let's pin poetry to ~0.12.17 for now and change it once poetry v1.0 releases.
Add doc about extracting timestamps with no spaces
Timestamp formats may have no space between date and time components and
cause the script to fail.
In Encryption docs, explain how to prevent Fish history logging
[#681] Update version handling in source and travis deployments
[#681] Appease the poetry gods
[#681] Separate local dev from pipeline releases
[#681] take out automated pages deployment (for now), since it broke the
site
If you use jrnl, you can totally make our day by just saying "thanks for the code." It's your chance to make a programmer happy today! If you have a moment, let us know what you use jrnl for and how; it'll help us to make it even better!
# Contributing
Docs & Typos
------------
If you find a typo or a mistake in the docs, please fix it right away and send a pull request. The Right Way™ to fix the docs is to edit the `docs/*.rst` files on the **master** branch. You can see the result if you run `make html` inside the project's root directory, and then open `docs/_build/html/index.html` in your browser. Note that this requires [lessc](http://lesscss.org/) and [Sphinx](https://pypi.python.org/pypi/Sphinx) to be installed. Changes to the CSS or Javascript should be made on `docs/_themes/jrnl/`. The `gh-pages` branch is automatically maintained and updates from `master`; you should never have to edit that.
Bugs
----
Unfortunately, bugs happen. If you found one, please [open a new issue](https://github.com/jrnl-org/jrnl/issues/new) and describe it as well as possible. If you're a programmer with some time, go ahead and send us a pull request! We'll review as quickly as we can.
Feature requests and ideas
--------------------------
So, you have an idea for a great feature? Awesome! We'd love to hear from you! Please [open a new issue](https://github.com/jrnl-org/jrnl/issues) and describe the goal of the feature, and any relvant use cases. We'll discuss the issue with you, and decide if it's a good fit for the project.
When discussing new features, please keep in mind our design goals. jrnl strives to do one thing well. To us, that means:
* be _slim_
* have a simple interface
* avoid dupicating functionality
A short note for new programmers and programmers new to python
Although jrnl has grown quite a bit since its inception. The overall complexity (for an end-user program) is fairly low, and we hope you'll find the code easy enough to understand.
If you have a question, please don't hesitate to ask! Python is known for its welcoming community and openness to novice programmers, so feel free to fork the code and play around with it! If you create something you want to share with us, please create a pull request. We never expect pull requests to be perfect, idiomatic, instantly mergeable code. We can work through it together!
See "[Contributing](docs/contributing.md)" in the `docs` directory.
_To get help, [submit an issue](https://github.com/jrnl-org/jrnl/issues/new) on Github._
_To get help, [submit an issue](https://github.com/jrnl-org/jrnl/issues/new/choose) on
GitHub._
*jrnl* is a simple journal application for your command line. Journals are stored as human readable plain text files - you can put them into a Dropbox folder for instant syncing and you can be assured that your journal will still be readable in 2050, when all your fancy iPad journal applications will long be forgotten.
`jrnl` is a simple journal application for the command line.
Optionally, your journal can be encrypted using the [256-bit AES](http://en.wikipedia.org/wiki/Advanced_Encryption_Standard).
You can use it to easily create, search, and view journal entries. Journals are
stored as human-readable plain text, and can also be encrypted using [AES
Journals aren't just for people who have too much time on their summer vacation. A journal helps you to keep track of the things you get done and how you did them. Your imagination may be limitless, but your memory isn't. For personal use, make it a good habit to write at least 20 words a day. Just to reflect what made this day special, why you haven't wasted it. For professional use, consider a text-based journal to be the perfect complement to your GTD todo list - a documentation of what and how you've done it.
To make a new entry, just enter
In a Nutshell
-------------
``` sh
jrnl yesterday: Called in sick. Used the time to clean the house and write my
book.
```
to make a new entry, just type
`yesterday:` is interpreted by `jrnl` as a timestamp. Everything until the
first sentence ending (either `.`, `?`, or `!`) is interpreted as the title, and
the rest as the body. In your journal file, the result will look like this:
jrnl yesterday: Called in sick. Used the time to clean the house and spent 4h on writing my book.
[2012-03-29 09:00] Called in sick.
Used the time to clean the house and write my book.
and hit return. `yesterday:` will be interpreted as a timestamp. Everything until the first sentence mark (`.?!`) will be interpreted as the title, the rest as the body. In your journal file, the result will look like this:
If you just call `jrnl`, you will be prompted to compose your entry - but you
can also configure _jrnl_ to use your external editor.
2012-03-29 09:00 Called in sick.
Used the time to clean the house and spent 4h on writing my book.
For more information, please read the
[documentation](https://jrnl.sh).
If you just call `jrnl`, you will be prompted to compose your entry - but you can also configure _jrnl_ to use your external editor.
## Contributors
Known Issues
------------
jrnl used to support integration with Day One, but no longer supports it since Day One 2 was released with a different backend. [See the GitHub issue for more information](https://github.com/jrnl-org/jrnl/issues/409).
### Maintainers
Authors
-------
Current maintainers:
Our maintainers help keep the lights on for the project:
If you've discovered a potential security issue in jrnl, please contact the maintainers at [maintainers@jrnl.sh](mailto:maintainers@jrnl.sh).
You can also feel free to [open an issue](https://github.com/jrnl-org/jrnl/issues/new/choose) (but please don't disclose the vulnerability) in case the email goes to spam.
You can find [known privacy and security issues in our documentation](https://jrnl.sh/en/stable/privacy-and-security/).
You can configure `jrnl`to use with multiple journals (eg.
`private` and `work`) by defining more journals in your `.jrnl_config`,
`private` and `work`) by defining more journals in your [config file](./reference-config-file.md),
for example:
``` javascript
{
...
"journals": {
"default": "~/journal.txt",
"work": "~/work.txt"
}
}
``` yaml
journals:
default: ~/journal.txt
work: ~/work.txt
```
The `default` journal gets created the first time you start `jrnl`
@ -106,40 +37,81 @@ will both use `~/work.txt`, while `jrnl -n 3` will display the last
three entries from `~/journal.txt` (and so does `jrnl default -n 3`).
You can also override the default options for each individual journal.
If you`.jrnl_config` looks like this:
If your `jrnl.yaml` looks like this:
``` javascript
{
...
"encrypt": false
"journals": {
"default": "~/journal.txt",
"work": {
"journal": "~/work.txt",
"encrypt": true
},
"food": "~/my_recipes.txt",
}
``` yaml
encrypt: false
journals:
default: ~/journal.txt
work:
journal: ~/work.txt
encrypt: true
food: ~/my_recipes.txt
```
Your `default` and your `food` journals won't be encrypted, however your
`work` journal will! You can override all options that are present at
the top level of `.jrnl_config`, just make sure that at the very least
you specify a `"journal": ...` key that points to the journal file of
`work` journal will!
You can override all options that are present at
the top level of `jrnl.yaml`, just make sure that at the very least
you specify a `journal: ...` key that points to the journal file of
that journal.
Consider the following example configuration
``` yaml
editor: vi -c startinsert
journals:
default: ~/journal.txt
work:
journal: ~/work.txt
encrypt: true
display_format: json
editor: code -rw
food:
display_format: markdown
journal: ~/recipes.txt
```
The `work` journal is encrypted, prints to `json` by default, and is edited using an existing window of VSCode. Similarly, the `food` journal prints to markdown by default, but uses all the other defaults.
### Modifying Configurations from the Command line
You can override a configuration field for the current instance of `jrnl` using `--config-override CONFIG_KEY CONFIG_VALUE` where `CONFIG_KEY` is a valid configuration field, specified in dot notation and `CONFIG_VALUE` is the (valid) desired override value. The dot notation can be used to change config keys within other keys, such as `colors.title` for the `title` key within the `colors` key.
You can specify multiple overrides as multiple calls to `--config-override`.
!!! note
Changing `encrypt` to a different value will not encrypt or decrypt your
journal file, it merely says whether or not your journal
is encrypted. Hence manually changing
this option will most likely result in your journal file being
impossible to load.
These overrides allow you to modify ***any*** field of your jrnl configuration. We trust that you know what you are doing.
## Known Issues
#### Examples:
### Unicode on Windows
``` sh
# Create an entry using the `stdin` prompt, for rapid logging
jrnl --config-override editor ""
The Windows shell prior to Windows 7 has issues with unicode encoding.
To use non-ascii characters, first tweak Python to recognize the encoding by adding `'cp65001': 'utf_8'`, to `Lib/encoding/aliases.py`. Then, change the codepage with `chcp 1252` before using `jrnl`.
# Populate a project's log
jrnl --config-override journals.todo "$(git rev-parse --show-toplevel)/todo.txt" todo find my towel
We welcome contributions to jrnl, whether it's through reporting bugs, improving the documentation, testing releases, engaging in discussion on features and bugs, or writing code.
## Table of Contents
* [Code of Conduct](#code-of-conduct)
* [Reporting Bugs](#reporting-bugs)
* [Editing Documentation](#editing-documentation)
* [Testing](#testing)
* [Submitting feature requests and ideas](#submitting-feature-requests-and-ideas)
* [Developing jrnl](#developing)
## Code of Conduct
Before starting, please read the [Code of Conduct](https://github.com/jrnl-org/jrnl/blob/develop/CODE_OF_CONDUCT.md).
## Reporting Bugs
Please report bugs by [opening a new issue](https://github.com/jrnl-org/jrnl/issues/new/choose) and describing it as well as possible. Many bugs are specific to a particular operating system and Python version, so please include that information!
## Editing Documentation
If you find a typo or a mistake in the docs, please fix it right away and send a pull request. If you're unsure what to change but still see a problem, you can [open a new issue](https://github.com/jrnl-org/jrnl/issues/new/choose) with the "Documentation change" type.
To edit the documentation, edit the `docs/*.md` files on the **develop** branch. You can see the result by running `poe docs-run` inside the project's root directory, then navigating your browser to [localhost:8000](http://localhost:8000).
### External editors and tips and tricks
If you'd like to share a jrnl command line trick that you find useful, you may find it worthwhile to add it to the ["Tips and Tricks" section](tips-and-tricks.md). For advice on how to integrate a particular external editor, you can add to the ["External Editors" section](external-editors.md).
## Testing
Much of the work of maintaining jrnl involves testing rather than coding.
The nature of jrnl means we deal with extremely sensitive data, and can't risk data loss. While jrnl does have a comprehensive automated testing suite, user testing is crucial to mitigating this risk.
### Prereleases
[Prereleases are deployed through PyPi much like normal releases](https://pypi.org/project/jrnl/#history). You can use [pipx](https://pypi.org/project/pipx/) to fetch them and test them. See the [changelog](https://github.com/jrnl-org/jrnl/blob/develop/CHANGELOG.md) for information on what has changed with each release.
### Pull requests
If you are comfortable enough with git, feel free to fetch particular [pull requests](https://github.com/jrnl-org/jrnl/pulls), test them yourself, and report back your findings. Bonus points if you can add a screencast of how the new feature works.
### Confirm bug reports
There are always [open bugs among our GitHub issues](https://github.com/jrnl-org/jrnl/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and many are specific to a particular OS, Python version, or jrnl version. A simple comment like "Confirmed on jrnl v2.2, MacOS 10.15, Python 3.8.1" would be extremely helpful in tracking down bugs.
### Automate tests
See the develop section below for information on how to contribute new automated tests.
## Submitting feature requests and ideas
If you have a feature request or idea for jrnl, please [open a new issue](https://github.com/jrnl-org/jrnl/issues/new/choose) and describe the goal of the feature, and any relevant use cases. We'll discuss the issue with you, and decide if it's a good fit for the project.
When discussing new features, please keep in mind our design goals. jrnl strives to
[do one thing well](https://en.wikipedia.org/wiki/Unix_philosophy). To us, that means:
* being _nimble_
* having a simple interface
* avoiding duplicating functionality
## Developing
### Getting your environment set up
You will need to install [poetry](https://python-poetry.org/) to develop jrnl. It will take care of all of the project's other dependencies.
### Understanding the branches
jrnl uses two primary branches:
* `develop` - for ongoing development
* `release` - for releases
In general, pull requests should be made on the `develop` branch.
### Common development commands
You can find an inventory of commands in the `pyproject.toml`. Users can run the commands by typing `poe` followed by the name of the command ([Poe the Poet](https://github.com/nat-n/poethepoet) can be installed on its own, or as part of `poetry install`).
A typical development workflow includes:
* Installing dependencies:
* `poetry install`
* Activate virtual environment:
* `poetry shell`
* Running the source in a virtual environment:
* `jrnl` (with or without arguments as necessary)
* Running tests:
* `poe test`
* Formatting the code to standardize its style:
* `poe format`
### Updating automated tests
When resolving bugs or adding new functionality, please add tests to prevent that functionality from breaking in the future. If you notice any functionality that isn't covered in the tests, feel free to submit a test-only pull request as well.
For testing, jrnl uses [pytest](https://docs.pytest.org) for unit tests, and [pytest-bdd](https://pytest-bdd.readthedocs.io/) for integration testing. All tests are in the `tests` folder.
Many tests can be created by only editing `*.feature` files with the same format as other tests. For more complicated functionality, you may need to implement steps in `tests/lib/` which are then executed by your tests in the `feature` files.
### Submitting pull requests
When you're ready, feel free to submit a pull request (PR). The jrnl maintainers generally review the pull requests every two weeks, but the continuous integration pipeline will run on automated tests on it within a matter of minutes and will report back any issues it has found with your code across a variety of environments.
The pull request template contains a checklist full of housekeeping items. Please fill them out as necessary when you submit.
If a pull request contains failing tests, it probably will not be reviewed, and it definitely will not be approved. However, if you need help resolving a failing test, please mention that in your PR.
### Finding things to work on
You can search the [jrnl GitHub issues](https://github.com/jrnl-org/jrnl/issues) by [label](https://github.com/jrnl-org/jrnl/labels) for things to work on. Here are some labels worth searching:
You can also get a feel for the project's priorities by reviewing the [milestones](https://github.com/jrnl-org/jrnl/milestones).
### A note for new programmers and programmers new to python
Although jrnl has grown quite a bit since its inception, the overall complexity (for an end-user program) is fairly low, and we hope you'll find the code easy enough to understand.
If you have a question, please don't hesitate to ask! Python is known for its welcoming community and openness to novice programmers, so feel free to fork the code and play around with it! If you create something you want to share with us, please create a pull request. We never expect pull requests to be perfect, idiomatic, instantly mergeable code. We can work through it together!
Configure your preferred external editor by updating the `editor` option
in your [configuration file](./reference-config-file.md#editor). If your editor is not
in your operating system's `PATH` environment variable, then you will have to
enter the full path of your editor.
Once it's configured, you can create an entry as a new document in your editor using the `jrnl`
command by itself:
``` text
jrnl
```
You can specify the time and title of the entry as usual on the first line of the document.
If you want, you can skip the editor by including a quick entry with the `jrnl` command:
``` text
jrnl yesterday: All my troubles seemed so far away.
```
If you want to start the entry on the command line and continue writing in your chosen editor,
use the `--edit` flag. For example:
``` text
jrnl yesterday: All my troubles seemed so far away. --edit
```
!!! note
To save and log any entry edits, save and close the file.
All editors must be [blocking processes](https://en.wikipedia.org/wiki/Blocking_(computing)) to work with jrnl. Some editors, such as [micro](https://micro-editor.github.io/), are blocking by default, though others can be made to block with additional arguments, such as many of those documented below. If jrnl opens your editor but finishes running immediately, then your editor is not a blocking process, and you may be able to correct that with one of the suggestions below.
Please see [this section](./privacy-and-security.md#editor-history) about how
your editor might leak sensitive information and how to mitigate that risk.
## Sublime Text
To use [Sublime Text](https://www.sublimetext.com/), install the command line
tools for Sublime Text and configure your `jrnl.yaml` like this:
```yaml
editor: "subl -w"
```
Note the `-w` flag to make sure `jrnl` waits for Sublime Text to close the
file before writing into the journal.
## Visual Studio Code
[Visual Studio Code](https://code.visualstudio.com) also requires a flag
that tells the process to wait until the file is closed before exiting:
```yaml
editor: "code --wait"
```
On Windows, `code` is not added to the path by default, so you'll need to
enter the full path to your `code.exe` file, or add it to the `PATH` variable.
## MacVim
Also similar to Sublime Text, MacVim must be started with a flag that tells
the the process to wait until the file is closed before passing control
back to journal. In the case of MacVim, this is `-f`:
```yaml
editor: "mvim -f"
```
## Vim/Neovim
To use any of the Vim derivatives as editor in Linux, simply set the `editor`
to the executable:
```yaml
editor: "vim"
# or
editor: "nvim"
```
## iA Writer
On OS X, you can use the fabulous [iA
Writer](http://www.iawriter.com/mac) to write entries. Configure your
`jrnl.yaml` like this:
```yaml
editor: "open -b pro.writer.mac -Wn"
```
What does this do? `open -b ...` opens a file using the application
identified by the bundle identifier (a unique string for every app out
there). `-Wn` tells the application to wait until it's closed before
passing back control, and to use a new instance of the application.
If the `pro.writer.mac` bundle identifier is not found on your system,
you can find the right string to use by inspecting iA Writer's
`Info.plist` file in your shell:
```sh
grep -A 1 CFBundleIdentifier /Applications/iA\ Writer.app/Contents/Info.plist
```
## Notepad++ on Windows
To set [Notepad++](http://notepad-plus-plus.org/) as your editor, edit
Or why not create a [beautiful timeline](http://timeline.knightlab.com/) of your journal?
**Example output**:
``` json
{
"tags": {
"@tag": 1
},
"entries": [
{
"title": "This is the first sample entry",
"body": "This is the sample body text of the first sample entry.",
"date": "2020-06-28",
"time": "18:22",
"tags": [],
"starred": false
},
{
"title": "This is the second sample entry",
"body": "This is the sample body text of the second sample entry, but this one has a @tag.",
"date": "2020-07-01",
"time": "20:00",
"tags": [
"@tag"
],
"starred": false
},
{
"title": "This is the third sample entry",
"body": "This is the sample body text of the third sample entry.",
"date": "2020-07-02",
"time": "09:00",
"tags": [],
"starred": false
}
]
}
```
### Markdown
``` sh
jrnl --format markdown
# or
jrnl --format md
```
Markdown is a simple markup language that is human readable and can be used to be
rendered to other formats (html, pdf). `jrnl`'s
[README](https://github.com/jrnl-org/jrnl/blob/develop/README.md) for example is
formatted in markdown, then Github adds some formatting to make it look nice.
The markdown format groups entries by date (first by year, then by month), and adds
header markings as needed (e.g. `#`, `##`, etc). If you already have markdown header
markings in your journal, they will be incremented as necessary to make them fit under
these new headers (i.e. `#` will become `##`).
This format can be very useful, for example, to export a journal to a program that
converts markdown to html to make a website or a blog from your journal.
**Example output**:
``` markdown
# 2020
## June
### 2020-06-28 18:22 This is the first sample entry
This is the sample body text of the first sample entry.
## July
### 2020-07-01 20:00 This is the second sample entry
This is the sample body text of the second sample entry, but this one has a @tag.
### 2020-07-02 09:00 This is the third sample entry
This is the sample body text of the third sample entry.
```
### Plain Text
``` sh
jrnl --format text
# or
jrnl --format txt
```
This outputs your journal in the same plain-text format that `jrnl` uses to store your
journal on disk. This format is particularly useful for importing and exporting journals
within `jrnl`.
You can use it, for example, to move entries from one journal to another, or to create a
new journal with search results from another journal.
**Example output**:
``` sh
[2020-06-28 18:22] This is the first sample entry
This is the sample body text of the first sample entry.
[2020-07-01 20:00] This is the second sample entry
This is the sample body text of the second sample entry, but this one has a @tag.
[2020-07-02 09:00] This is the third sample entry
This is the sample body text of the third sample entry.
```
### XML
``` sh
jrnl --format xml
```
This outputs your journal into XML format. XML is a commonly used data format and is
supported by many programs and programming languages.
**Example output**:
``` xml
<?xml version="1.0" ?>
<journal>
<entries>
<entrydate="2020-06-28T18:22:00"starred="">This is the first sample entry This is the sample body text of the first sample entry.</entry>
<entrydate="2020-07-01T20:00:00"starred="">
<tagname="@tag"/>
This is the second sample entry This is the sample body text of the second sample entry, but this one has a @tag.
</entry>
<entrydate="2020-07-02T09:00:00"starred="">*This is the third sample entry, and is starred This is the sample body text of the third sample entry.</entry>
</entries>
<tags>
<tagname="@tag">1</tag>
</tags>
</journal>
```
### YAML
``` sh
jrnl --format yaml --file 'my_directory/'
```
This outputs your journal into YAML format. YAML is a commonly used data format and is
supported by many programs and programming languages. [Exporting to directories](#exporting-to-directories) is the
only supported YAML export option and each entry will be written to a separate file.
**Example file**:
``` yaml
title: This is the second sample entry
date: 2020-07-01 20:00
starred: False
tags: tag
This is the sample body text of the second sample entry, but this one has a @tag.
```
## Report formats
Since formats use your journal data and display it in different ways, they can also be
used to create reports.
### Tags
``` sh
jrnl --format tags
# or
jrnl --tags
```
This format is a simple example of how formats can be used to create reports. It
displays each tag, and a count of how many entries in which tag appears in your journal
(or in the search results), sorted by most frequent.
`jrnl` can store your journal in a few different ways:
- a single text file (encrypted or otherwise)
- a folder structure organized by date containing unencrypted text files
- the DayOne Classic format
There is no need to specify what type of journal you'd like to use. Instead,
`jrnl` will automatically detect the journal type based on whether you're
referencing a file or a folder in your [config file](advanced.md),
and if it's a folder, whether or not DayOne Classic content exists in it.
## Single File
The single file format is the most flexible, as it can be [encrypted](encryption.md).
To use it, enter any path that is a file or does not already exist. You can
use any extension. `jrnl` will automatically create the file when you save
your first entry.
## Folder
The folder journal format organizes your entries into subfolders for the year
and month and `.txt` files for each day. If there are multiple entries in a day,
they all appear in the same `.txt` file.
The directory tree structure is in this format: `YYYY/MM/DD.txt`. For instance, if
you have an entry on May 5th, 2021 in a folder journal at `~/folderjournal`, it will
be located in: `~/folderjournal/2021/05/05.txt`
!!! note
Creating a new folder journal can be done in two ways:
* Create a folder with the name of the journal before running `jrnl`. Otherwise, when you run `jrnl` for the first time, it will assume that you are creating a single file journal instead, and it will create a file at that path.
* Create a new journal in your [config_file](advanced.md) and end the path with a ``/`` (on a POSIX system like Linux or MacOSX) or a ``\`` (on a Windows system). The folder will be created automatically if it doesn't exist.
!!! note
Folder journals can't be encrypted.
## Day One Classic
`jrnl` supports the original data format used by DayOne. It's similar to the folder
journal format, except it's identified by either of these characteristics:
* the folder has a `.dayone` extension
* the folder has a subfolder named `entries`
This is not to be confused with the DayOne 2.0 format, [which is very different](https://help.dayoneapp.com/en/articles/1187337-day-one-classic-is-retired).
!!! note
DayOne Classic journals can't be encrypted.
## Changing your journal type
You can't simply modify a journal's configuration to change its type. Instead,
define a new journal as the type you'd like, and use
These commands will exit after they complete. You may only run one at a time.
### --help
Show a help message.
### --version
Print version and license information.
### --list
List the config file location, all configured journals, and their locations.
### ---encrypt
Encrypt a journal. See [encryption](encryption.md) for more information.
### --decrypt
Decrypt a journal. See [encryption](encryption.md) for more information.
### --import
Import entries from another journal. If any entries have the exact same content
and timestamp, they will be deduplicated.
Optional parameters:
```sh
--file FILENAME
```
Specify a file to import. If not provided, `jrnl` will use STDIN as the data source.
```sh
--format TYPE
```
Specify the format of the file that is being imported. Defaults to the same data
storage method that jrnl uses. See [formats](formats.md) for more information.
## Writing new entries
See [Basic Usage](usage.md).
## Searching
To find entries from your journal, use any combination of the below filters.
Only entries that match all the filters will be displayed.
When specifying dates, you can use the same kinds of dates you use for new
entries, such as `yesterday`, `today`, `Tuesday`, or `2021-08-01`.
| Search Argument | Description |
| --- | --- |
| -on DATE | Show entries on this date |
| -today-in-history | Show entries of today over the years |
| -month DATE | Show entries on this month of any year |
| -day DATE | Show entries on this day of any month |
| -year DATE | Show entries of a specific year |
| -from DATE | Show entries after, or on, this date |
| -to DATE | Show entries before, or on, this date (alias: -until) |
| -contains TEXT | Show entries containing specific text (put quotes around text with spaces) |
| -and | Show only entries that match all conditions, like saying "x AND y" (default: OR) |
| -starred | Show only starred entries (marked with *) |
| -tagged | Show only tagged entries (marked with the [configured tagsymbols](reference-config-file.md#tagsymbols)) |
| -n [NUMBER] | Show a maximum of NUMBER entries (note: '-n 3' and '-3' have the same effect) |
| -not [TAG] | Exclude entries with this tag |
| -not -starred | Exclude entries that are starred |
| -not -tagged | Exclude entries that are tagged |
## Searching Options
These help you do various tasks with the selected entries from your search.
If used on their own (with no search), they will act on your entire journal.
### --edit
Opens the selected entries in your configured editor. It will fail if the
`editor` key is not set in your config file.
Once you begin editing, you can add multiple entries and delete entries
by modifying the text in your editor. When your editor closes, jrnl reads
the temporary file you were editing and makes the changes to your journal.
### --delete
Interactively deletes selected entries. You'll be asked to confirm deletion of
each entry.
### --change-time DATE
Interactively changes the time of the selected entries to the date specified,
or to right now if no date is specified. You'll be asked to confirm each entry,
unless you are using this with `--edit` on a single entry.
### --format TYPE
Display selected entries in an alternate format. See [formats](formats.md).
#### Optional parameters
```sh
--file FILENAME
```
Write output to file instead of STDOUT. In most shells, the
same effect can be achieved using `>`.
### --tags
Alias for '--format tags'. Returns a list of all tags and the number of times
they occur within the searched entries. If there are no tags found, `jrnl` will output a message saying so.
### --short
Only shows the date and titles of the searched entries.
## Configuration arguments
### --config-override CONFIG_KEY CONFIG_VALUE
Override configured key-value pair with CONFIG_KV_PAIR for this command invocation only. To access config keys that aren't at the top level, separate the keys with a dot, such as `colors.title` to access the `title` key within the `colors` key. Read [advanced usage](./advanced.md) for examples.
### --config-file CONFIG_FILE_PATH
Use the config file at CONFIG_FILE_PATH for this command invocation only.
Read [advanced usage](./advanced.md) for examples.
## Other Arguments
### --debug
Prints information useful for troubleshooting while `jrnl` executes.
### --diagnostic
Prints diagnostic information useful for [reporting issues](https://github.com/jrnl-org/jrnl/issues).
Templates require an [external editor](./advanced.md) be configured.
Templates are text files that are used for creating structured journals.
There are three ways you can use templates:
### 1. Use the `--template` command line argument and the default $XDG_DATA_HOME/jrnl/templates directory
`$XDG_DATA_HOME/jrnl/templates` is created by default to store your templates! Create a template (like `default.md`) in this directory and pass `--template FILE_IN_DIR`.
```sh
jrnl --template default.md
```
### 2. Use the `--template` command line argument with a local / absolute path
You can create a template file with any text. Here is an example:
```sh
# /tmp/template.txt
My Personal Journal
Title:
Body:
```
Then, pass the absolute or relative path to the template file as an argument, and your external
editor will open and have your template pre-populated.
```sh
jrnl --template /tmp/template.md
```
### 3. Set a default template file in `jrnl.yaml`
If you want a template by default, change the value of `template` in the [config file](./reference-config-file.md)
from `false` to the template file's path, wrapped in double quotes:
```sh
...
template: "/path/to/template.txt"
...
```
!!! tip
To read your journal entry or to verify the entry saved, you can use this
command: `jrnl -n 1` (Check out [Formats](./formats.md) for more options).
```sh
jrnl -n 1
```
## Prompts on shell reload
If you'd like to be prompted each time you refresh your shell, you can include
this in your `.bash_profile`:
```sh
function log_question()
{
echo $1
read
jrnl today: ${1}. $REPLY
}
log_question 'What did I achieve today?'
log_question 'What did I make progress with?'
```
Whenever your shell is reloaded, you will be prompted to answer each of the
questions in the example above. Each answer will be logged as a separate
journal entry at the `default_hour` and `default_minute` listed in your
Out of the box, `jrnl` can output journal entries in Markdown. To visualize it, you can pipe to [mdless](https://github.com/ttscoff/mdless), which is a [less](https://en.wikipedia.org/wiki/Less_(Unix))-like tool that allows you to visualize your Markdown text with formatting and syntax highlighting from the CLI. You can use this in any shell that supports piping.
The simplest way to visualize your Markdown output with `mdless` is as follows:
```sh
jrnl --export md | mdless
```
This will render your Markdown output in the whole screen.
Fortunately, `mdless` has an option that allows you to adjust the screen width by using the `-w` option as follows:
```sh
jrnl --export md | mdless -w 70
```
If you want Markdown to be your default display format, you can define this in your config file as follows:
```yaml
display_format: md
# or
display_format: markdown
```
For more information on how `jrnl` outputs your entries in Markdown, please visit the [Formats](./formats.md) section.
## Jump to end of buffer (with vi)
To cause vi to jump to the end of the last line of the entry you edit, in your config file set:
```yaml
editor: vi + -c "call cursor('.',strwidth(getline('.')))"
`jrnl` has two modes: **composing** and **viewing**. Basically, whenever
you *don't* supply any arguments that start
with a dash or double-dash, you're in composing mode, meaning you can
write your entry on the command line or an editor of your choice.
# Basic Usage #
We intentionally break a convention on command line arguments: all
arguments starting with a *single dash*
will *filter* your journal before viewing
it, and can be combined arbitrarily. Arguments with a
*double dash* will control how your journal
is displayed or exported and are mutually exclusive (ie. you can only
specify one way to display or export your journal at a time).
`jrnl` has two modes: **composing** and **viewing**. Whenever you don't enter
any arguments that start with a dash (`-`) or double-dash (`--`), you're in
composing mode, meaning that you can write your entry on the command line.
## Listing Journals
We intentionally break a convention on command line arguments: all arguments
starting with a _single dash_ (`-`) will _filter_ your journal before viewing
it. Filter arguments can be combined arbitrarily. Arguments with a _double dash_
(`--`) will _control_ how your journal is displayed or exported. Control
arguments are mutually exclusive (i.e., you can only specify one way to display
or export your journal at a time).
You can list the journals accessible by jrnl
For a list of commands, enter `jrnl --help`.
``` sh
jrnl -ls
```
## Composing Entries ##
The journals displayed correspond to those specified in the jrnl
configuration file.
Composing mode is entered by either starting `jrnl` without any arguments --
which will launch an external editor -- or by just writing an entry on the
command line:
## Composing Entries
Composing mode is entered by either starting `jrnl` without any
arguments -- which will prompt you to write an entry or launch your
editor -- or by just writing an entry on the prompt, such as
``` sh
jrnl today at 3am: I just met Steve Buscemi in a bar! He looked funny.
```text
jrnl today at 3am: I just met Steve Buscemi in a bar! What a nice guy.
```
!!! note
Most shell contains a certain number of reserved characters, such as `#`
and `*`. Unbalanced quotes, parenthesis, and so on will also get into
the way of your editing.
For writing longer entries, just enter `jrnl`
and hit `return`. Only then enter the text of your journal entry.
Alternatively, `use an external editor <advanced>`).
Most shells contain a certain number of reserved characters, such as `#` and
`*`. These characters, as well as unbalanced single or double quotation
marks, parentheses, and others, likely will cause problems. Although
reserved characters can be escaped using `\`, this is not ideal for
long-form writing. The solution: first enter `jrnl` and hit `return`. You
can then enter the text of your journal entry. Alternatively, you can [use
an external editor](./advanced.md).
You can also import an entry directly from a file
You can also import an entry directly from a file:
```sh
jrnl <my_entry.txt
```
### Smart timestamps
### Specifying Date and Time ###
Timestamps that work:
If you don't specify a date and time (e.g., `jrnl finished writing letter to brother`), `jrnl` will create an entry using the current date and time. For retrospective entries, you can use a timestamp to tell `jrnl` where to put the entry. Timestamps can be entered using a variety of formats. Here are some that work:
- at 6am
- yesterday
@ -59,124 +54,203 @@ Timestamps that work:
- 2 march 2012
- 7 apr
- 5/20/1998 at 23:42
- 2020-05-22T15:55-04:00
### Starring entries
If you don't use a timestamp, `jrnl` will create an entry using the current
time. If you use a date only (no time), `jrnl` will use the default time
specified in your [configuration file](./reference-config-file.md#default_hour-and-default_minute).
Behind the scenes, `jrnl` reorganizes entries in chronological order.
To mark an entry as a favourite, simply "star" it
### Using Tags ###
`jrnl` supports tags. The default tag symbol is `@` (largely because `#` is a
reserved character). You can specify your own tag symbol in the
[configuration file](./reference-config-file.md#tagsymbols). To use tags, preface the
desired tag with the symbol:
```sh
jrnl Had a wonderful day at the @beach with @Tom and @Anna.
```
Although you can use capitals while tagging an entry, searches by tag are
case-insensitive.
There is no limit to how many tags you can use in an entry.
### Starring Entries ###
To mark an entry as a favorite, simply "star" it using an asterisk (`*`):
```sh
jrnl last sunday *: Best day of my life.
```
If you don't want to add a date (ie. your entry will be dated as now),
The following options are equivalent:
If you don't want to add a date (i.e., you want the date to be entered as
_now_), the following options are equivalent:
- `jrnl *: Best day of my life.`
- `jrnl *Best day of my life.`
- `jrnl Best day of my life.*`
!!! note
Just make sure that the asterisk sign is **not** surrounded by
whitespaces, e.g. `jrnl Best day of my life! *` will **not** work (the
reason being that the `*` sign has a special meaning on most shells).
Make sure that the asterisk (`*`) is **not** surrounded by whitespaces.
`jrnl Best day of my life! *` will not work because the `*` character has a
special meaning in most shells.
## Viewing
## Viewing and Searching Entries ##
`jrnl` can display entries in a variety of ways.
To view all entries, enter:
```sh
jrnl -to today
```
`jrnl` provides several filtering commands, prefaced by a single dash (`-`), that
allow you to find a more specific range of entries. For example,
```sh
jrnl -n 10
```
will list you the ten latest entries (if you're lazy, `jrnl -10` will do
the same),
lists the ten most recent entries. `jrnl -10` is even more concise and works the
same way. If you want to see all of the entries you wrote from the beginning of
last year until the end of this past March, you would enter
```sh
jrnl -from "last year" -until march
jrnl -from "last year" -to march
```
everything that happened from the start of last year to the start of
last march. To only see your favourite entries, use
Filter criteria that use more than one word require surrounding quotes (`""`).
To see entries on a particular date, use `-on`:
```sh
jrnl -on yesterday
```
### Text Search ###
The `-contains` command displays all entries containing the text you enter after it.
This may be helpful when you're searching for entries and you can't remember if you
tagged any words when you wrote them.
You may realize that you use a word a lot and want to turn it into a tag in all
of your previous entries.
```sh
jrnl -starred
jrnl -contains "dogs" --edit
```
## Using Tags
opens your external editor so that you can add a tag symbol (`@` by default) to
all instances of the word "dogs."
Keep track of people, projects or locations, by tagging them with an `@`
in your entries
### Filtering by Tag ###
``` sh
jrnl Had a wonderful day on the @beach with @Tom and @Anna.
```
You can filter your journal entries just like this:
You can filter your journal entries by tag. For example,
```sh
jrnl @pinkie@WorldDomination
```
Will print all entries in which either `@pinkie` or `@WorldDomination`
occurred.
displays all entries in which either `@pinkie` or `@WorldDomination`
occurred. Tag filters can be combined with other filters:
```sh
jrnl -n 5 -and @pineapple@lubricant
jrnl -n 5 @pinkie -and @WorldDomination
```
the last five entries containing both `@pineapple`**and**`@lubricant`.
You can change which symbols you'd like to use for tagging in the
configuration.
displays the last five entries containing _both_`@pinkie` _and_
`@worldDomination`. You can change which symbols you'd like to use for tagging
in the [configuration file](./reference-config-file.md#tagsymbols).
!!! note
`jrnl @pinkie @WorldDomination` will switch to viewing mode because
although **no** command line arguments are given, all the input strings
look like tags - *jrnl* will assume you want to filter by tag.
Entering `jrnl @pinkie @WorldDomination` will display entries in which both
tags are present because, although no command line arguments are given, all
of the input strings look like tags. `jrnl` will assume you want to filter
by tag, rather than create a new entry that consists only of tags.
## Editing older entries
You can edit selected entries after you wrote them. This is particularly
useful when your journal file is encrypted or if you're using a DayOne
journal. To use this feature, you need to have an editor configured in
your journal configuration file (see `advanced usage <advanced>`)
To view a list of all tags in the journal, enter:
```sh
jrnl -until 1950 @texas -and @history --edit
jrnl --tags
```
Will open your editor with all entries tagged with `@texas` and
`@history` before 1950. You can make any changes to them you want; after
you save the file and close the editor, your journal will be updated.
### Viewing Starred Entries ###
Of course, if you are using multiple journals, you can also edit e.g.
the latest entry of your work journal with `jrnl work -n 1 --edit`. In
any case, this will bring up your editor and save (and, if applicable,
encrypt) your edited journal after you save and exit the editor.
You can also use this feature for deleting entries from your journal
To display only your favorite (starred) entries, enter
```sh
jrnl @girlfriend -until 'june 2012' --edit
jrnl -starred
```
Just select all text, press delete, and everything is gone...
## Editing Entries ##
### Editing DayOne Journals
You can edit entries after writing them. This is particularly useful when your
journal file is encrypted. To use this feature, you need to have an external
editor configured in your [configuration file](./reference-config-file.md#editor). You
can also edit only the entries that match specific search criteria. For example,
DayOne journals can be edited exactly the same way, however the output
looks a little bit different because of the way DayOne stores its
entries:
```md
# af8dbd0d43fb55458f11aad586ea2abf
2013-05-02 15:30 I told everyone I built my @robot wife for sex.
But late at night when we're alone we mostly play Battleship.
# 2391048fe24111e1983ed49a20be6f9e
2013-08-10 03:22 I had all kinds of plans in case of a @zombie attack.
I just figured I'd be on the other side.
```sh
jrnl -to 1950 @texas -and @history --edit
```
The long strings starting with hash symbol are the so-called UUIDs,
unique identifiers for each entry. Don't touch them. If you do, then the
old entry would get deleted and a new one written, which means that you
could lose DayOne data that jrnl can't handle (such as as the entry's
geolocation).
opens your external editor displaying all entries tagged with `@texas` and
`@history` that were written before 1950. After making changes, save and close
the file, and only those entries will be modified (and encrypted, if
applicable).
If you are using multiple journals, it's easy to edit specific entries from
specific journals. Simply prefix the filter string with the name of the journal.
For example,
```sh
jrnl work -n 1 --edit
```
opens the most recent entry in the 'work' journal in your external editor.
## Deleting Entries ##
The `--delete` command opens an interactive interface for deleting entries. The
date and title of each entry in the journal are presented one at a time, and you
can choose whether to keep or delete each entry.
If no filters are specified, `jrnl` will ask you to keep or delete each entry in
the entire journal, one by one. If there are a lot of entries in the journal, it
may be more efficient to filter entries before passing the `--delete` command.
Here's an example. Say you have a journal into which you've imported the last 12
years of blog posts. You use the `@book` tag a lot, and for some reason you want
to delete some, but not all, of the entries in which you used that tag, but only
the ones you wrote at some point in 2004 or earlier. You're not sure which
entries you want to keep, and you want to look through them before deciding.
This is what you might enter:
```sh
jrnl -to 2004 @book --delete
```
`jrnl` will show you only the relevant entries, and you can choose the ones you
want to delete.
You may want to delete _all_ of the entries containing `@book` that you wrote in
2004 or earlier. If there are dozens or hundreds, the easiest way would be to
use an external editor. Open an editor with the entries you want to delete...
```sh
jrnl -to 2004 @book --edit
```
...select everything, delete it, save and close, and all of those entries are
removed from the journal.
## Listing Journals ##
To list all of your journals:
```sh
jrnl --list
```
The journals displayed correspond to those specified in the `jrnl`
<aid="twitter"href="https://twitter.com/intent/tweet?text=Write+your+memoirs+on+the+command+line.+Like+a+boss.+%23jrnl&url=http%3A%2F%2Fjrnl.sh&via=maebert"><iclass="icon twitter"></i>Tell your friends</a>
<aid="twitter"href="https://twitter.com/intent/tweet?text=Collect+your+thoughts+and+notes+without+leaving+the+command+line.+https%3A%2F%2Fjrnl.sh+via+@JrnlSh"><iclass="icon twitter"></i>Tell your friends</a>
<h1>Collect your thoughts and notes <br/>without leaving the command line.</h1>
</div>
<divid="prompt">
@ -57,9 +63,9 @@
<main>
<nav>
<ahref="overview">Documentation</a>
<ahref="http://github.com/jrnl-org/jrnl" title="View on Github">Fork me on GitHub</a>
<aid="twitter-nav"href="https://twitter.com/intent/tweet?text=Write+your+memoirs+on+the+command+line.+Like+a+boss.+%23jrnl&url=http%3A%2F%2Fjrnl.sh&via=maebert">Tell your friends on twitter</a>
<ahref="installation"class="cta">Download</a>
<ahref="installation" class="cta">Get Started</a>
<ahref="http://github.com/jrnl-org/jrnl"title="View on Github">Fork on GitHub</a>
<aid="twitter-nav"href="https://twitter.com/intent/tweet?text=Collect+your+thoughts+and+notes+without+leaving+the+command+line.+https%3A%2F%2Fjrnl.sh+via+@JrnlSh">Tell your friends on X</a>
</nav>
<divclass="flex">
<section>
@ -70,27 +76,22 @@
<section>
<iclass="icon future"></i>
<h3>Future-proof.</h3>
<p>Your journals are stored in plain-text files that will still be readable in 50 years when all your fancy iPad apps will have gone the way of the Dodo.</p>
<p>Your journals are stored in plain-text files that will still be readable in 50 years when your fancy proprietary apps will have gone the way of the dodo.</p>
</section>
<section>
<iclass="icon secure"></i>
<h3>Secure.</h3>
<p>Encrypt your journals with the industry-strength AES encryption. The NSA won't be able to read your dirty secrets.</p>
<p>Encrypt your journals with industry-strength AES encryption. Nobody will be able to read your dirty secrets—not even you, if you lose your password!</p>
</section>
<section>
<iclass="icon sync"></i>
<h3>Accessible anywhere.</h3>
<p>Sync your journals with Dropbox and capture your thoughts where ever you are</p>
</section>
<section>
<iclass="icon dayone"></i>
<h3>DayOne compatible.</h3>
<p>Read, write and search your DayOne journal from the command line.</p>
<p>Sync your journal files with other tools like Dropbox to capture your thoughts wherever you are.</p>
</section>
<section>
<iclass="icon github"></i>
<h3>Free & Open Source.</h3>
<p>jrnl is made by a bunch of really friendly and remarkably attractive people. Maybe even <ahref="https://www.github.com/jrnl-org/jrnl"title="Fork jrnl on GitHub">you</a>?</p>
<p>jrnl is made by a bunch of really friendly and remarkably amazing people. Maybe even <ahref="https://www.github.com/jrnl-org/jrnl"title="Fork jrnl on GitHub">you</a>?</p>
</section>
<section>
<iclass="icon folders"></i>
@ -100,23 +101,23 @@
</div>
</main>
<footer>
jrnl is made with love by <arel="author"href="http://www.1450.me">Manuel Ebert</a> and <ahref="https://github.com/jrnl-org/jrnl/graphs/contributors"title="Contributors">many other fabulous people</a>. If you need help, <ahref="https://github.com/jrnl-org/jrnl/issues/new" title="Open a new issue on Github">submit an issue</a> on Github.
jrnl is made with love by <ahref="https://github.com/jrnl-org/jrnl/graphs/contributors"title="Contributors">many fabulous people</a>. If you need help, <ahref="https://github.com/jrnl-org/jrnl/issues/new/choose" title="Open a new issue on Github">submit an issue</a> on Github.
parser.add_argument('-d','--debug',dest='debug',action='store_true',help='execute in debug mode')
composing=parser.add_argument_group('Composing','To write an entry simply write it on the command line, e.g. "jrnl yesterday at 1pm: Went to the gym."')
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('-until','-to',dest='end_date',metavar="DATE",help='View entries before this date')
reading.add_argument('-on',dest='on_date',metavar="DATE",help='View entries on this date')
reading.add_argument('-and',dest='strict',action="store_true",help='Filter by tags using AND (default: OR)')
reading.add_argument('-starred',dest='starred',action="store_true",help='Show only starred entries')
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('-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.EXPORT_FORMATS,help='Export your journal. TYPE can be {}.'.format(plugins.util.oxford_list(plugins.EXPORT_FORMATS)),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)
exporting.add_argument('--import',metavar='TYPE',dest='import_',choices=plugins.IMPORT_FORMATS,help='Import entries into your journal. TYPE can be {}, and it defaults to jrnl if nothing else is specified.'.format(plugins.util.oxford_list(plugins.IMPORT_FORMATS)),default=False,const='jrnl',nargs='?')
exporting.add_argument('-i',metavar='INPUT',dest='input',help='Optionally specifies input file when using --import.',default=False,const=None)
exporting.add_argument('--encrypt',metavar='FILENAME',dest='encrypt',help='Encrypts your existing journal with a new password',nargs='?',default=False,const=None)
exporting.add_argument('--decrypt',metavar='FILENAME',dest='decrypt',help='Decrypts your journal and stores it in plain text',nargs='?',default=False,const=None)
exporting.add_argument('--edit',dest='edit',help='Opens your editor to edit the selected entries.',action="store_true")
returnparser.parse_args(args)
defguess_mode(args,config):
"""Guesses the mode (compose, read or export) from the given arguments"""
util.prompt("[{1}ERROR{2}: You need to specify an editor in {0} to use the --edit function.]".format(install.CONFIG_FILE_PATH,ERROR_COLOR,RESET_COLOR))