Compare commits

..

815 commits

Author SHA1 Message Date
Jrnl Bot
7923e815f7 Update changelog [ci skip] 2025-04-29 03:08:35 +00:00
Micah Jerome Ellison
72d4968471
Rename Poetry dev dependency group in pyproject.toml (#1995)
* Rename pyproject group to comply with poetry

* Run poetry lock
2025-04-28 20:06:32 -07:00
Jrnl Bot
c286012bef Update changelog [ci skip] 2025-04-29 02:36:25 +00:00
Micah Jerome Ellison
c415c68443
Remove publish-to-homebrew step (#1994) 2025-04-28 19:34:45 -07:00
Jrnl Bot
e5fc8be2a8 Update changelog [ci skip] 2025-04-04 02:17:55 +00:00
renovate[bot]
20a087f64c
Update dependency rich to v14 (#1989)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 19:16:22 -07:00
Jrnl Bot
a2eb68963b Update changelog [ci skip] 2025-04-04 02:14:52 +00:00
renovate[bot]
89be61ccf8
Update dependency tox to v4.25.0 (#1986)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 19:13:03 -07:00
renovate[bot]
98d0bcac20
Update dependency poethepoet to v0.33.1 (#1982)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 19:12:40 -07:00
renovate[bot]
a282440118
Update dependency tzlocal to v5.3.1 (#1984)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 19:11:56 -07:00
renovate[bot]
7e72386da1
Update dependency cryptography to v44.0.2 (#1980)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 19:11:15 -07:00
renovate[bot]
6f1e8e5853
Update dependency jinja2 to v3.1.6 (#1983)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 19:10:43 -07:00
renovate[bot]
906a3fed78
Update dependency pytest to v8.3.5 (#1981)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 19:10:15 -07:00
Edoardo Baldi
8329cf5537
Add user-friendly message when missing importer (#1959) 2025-04-03 18:48:04 -07:00
Jrnl Bot
1dd2d48068 Update changelog [ci skip] 2025-04-04 01:35:11 +00:00
renovate[bot]
43310f399d
Update dependency ruff to v0.11.3 (#1978)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 18:33:25 -07:00
renovate[bot]
591f2457c3
Update dependency python to 3.13 (#1988)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 18:32:32 -07:00
Jrnl Bot
8be5b722aa Update changelog [ci skip] 2025-02-25 05:03:32 +00:00
Jrnl Bot
7249adb232 Increment version to v4.2.1 2025-02-25 05:02:27 +00:00
Jrnl Bot
fbd1b9e78b Update changelog [ci skip] 2025-02-25 05:00:06 +00:00
renovate[bot]
2581c43ae7
Update dependency pytest-bdd to v8.1.0 (#1952)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:58:12 -08:00
renovate[bot]
2035619587
Update dependency poethepoet to v0.32.2 (#1951)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:58:01 -08:00
renovate[bot]
37f634ac80
Update dependency tzlocal to v5.3 (#1972)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:57:21 -08:00
Jrnl Bot
d1e3e546f2 Update changelog [ci skip] 2025-02-25 04:57:00 +00:00
renovate[bot]
f8d80b2877
Update dependency jinja2 to v3.1.5 (#1966)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:55:10 -08:00
Jrnl Bot
8589b2ed65 Update changelog [ci skip] 2025-02-25 04:52:30 +00:00
renovate[bot]
6645b1e36f
Update dependency ruamel.yaml to v0.18.10 (#1967)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:51:02 -08:00
Jrnl Bot
316b9761d5 Update changelog [ci skip] 2025-02-25 04:49:07 +00:00
Jonathan Wren
e2a62e99a0
Update dependency pytest to >=8.1.1 (#1974)
* update pytest in deps

* update lock file

* update lock file
2025-02-24 20:47:32 -08:00
Jrnl Bot
692d0cb132 Update changelog [ci skip] 2025-02-25 04:39:11 +00:00
renovate[bot]
573e34fb48
Update dependency tox to v4.24.1 (#1945)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:36:33 -08:00
renovate[bot]
f2bb5eb501
Update dependency black to v25 (#1973)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:35:42 -08:00
Jrnl Bot
7ad6fca011 Update changelog [ci skip] 2025-02-25 04:32:45 +00:00
renovate[bot]
640150bcbe
Update dependency cryptography to v44 (#1962)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:30:38 -08:00
renovate[bot]
75c98a408c
Update dependency rich to v13.9.4 (#1946)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:30:03 -08:00
renovate[bot]
b8a8de98c3
Update dependency keyring to v25.6.0 (#1948)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:29:02 -08:00
Jrnl Bot
85eb730186 Update changelog [ci skip] 2025-02-25 04:28:43 +00:00
renovate[bot]
024ea00a95
Update dependency ruff to v0.9.7 (#1947)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 20:27:11 -08:00
Carl Smedstad
1530ad39a1
Update pytest-bdd to v8.0 (#1955)
* 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>
2025-02-24 20:16:54 -08:00
Jrnl Bot
505a9b6846 Update changelog [ci skip] 2025-02-25 03:26:36 +00:00
David Sosa
30c341ef8b
fix typed.js URL (#1970) 2025-02-24 19:25:01 -08:00
Jrnl Bot
ccb64b1721 Update changelog [ci skip] 2025-02-25 03:15:37 +00:00
Jonathan Wren
a1b3a612a5
Remove deprecated command in Poetry >2.0 causing error in CI (#1971)
* remove deprecated flag from install command
* Change poetry install to poetry sync
* Change other poetry install to poetry sync

---------

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2025-02-24 19:14:00 -08:00
Micah Jerome Ellison
247129c760
Fix 4.2 changelog by reverting to cleaned beta changelog (#1960) 2024-11-17 16:12:03 -08:00
Jrnl Bot
bb71dff815 Update changelog [ci skip] 2024-11-17 23:54:47 +00:00
Jrnl Bot
ba18bed4d7 Increment version to v4.2 2024-11-17 23:53:30 +00:00
Jrnl Bot
eb5fe6fef1 Update changelog [ci skip] 2024-10-19 22:06:23 +00:00
Jrnl Bot
16a0f043b1 Increment version to v4.2-beta 2024-10-19 22:04:52 +00:00
Micah Jerome Ellison
b760759906
Changelog cleanup (#1944)
* Sort packages and and remove extraneous entries

* Move docs accessibility issues to docs section
2024-10-19 14:54:41 -07:00
Jrnl Bot
2ce567e495 Update changelog [ci skip] 2024-10-19 21:30:10 +00:00
Micah Jerome Ellison
1143fba023
Force brighter color with XML syntax highlighting (#1943) 2024-10-19 14:28:21 -07:00
renovate[bot]
41279ae943
Update peter-evans/create-pull-request action to v7 (#1929)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-19 14:27:25 -07:00
Jrnl Bot
985187f866 Update changelog [ci skip] 2024-10-19 21:24:20 +00:00
renovate[bot]
53fef9021d
Update dependency typed.js to v2.1.0 (#1861)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-19 14:22:53 -07:00
Jrnl Bot
df4a5a5867 Update changelog [ci skip] 2024-10-19 21:20:37 +00:00
renovate[bot]
3f3bf3e77e
Update dependency xmltodict to v0.14.2 (#1940)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-19 14:19:03 -07:00
Jrnl Bot
1b79f0b340 Update changelog [ci skip] 2024-10-19 21:18:52 +00:00
renovate[bot]
428549778c
Update dependency parse-type to v0.6.4 (#1936)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-19 14:17:03 -07:00
Jrnl Bot
d9dae7af04 Update changelog [ci skip] 2024-10-19 21:15:48 +00:00
renovate[bot]
5f6be07fbd
Update dependency ruff to v0.7.0 (#1938)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-19 14:14:22 -07:00
renovate[bot]
a94f7c6161
Update dependency rich to v13.9.2 (#1937)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-19 14:13:55 -07:00
Jrnl Bot
086c34a6a7 Update changelog [ci skip] 2024-10-19 21:08:27 +00:00
renovate[bot]
0044b2dee8
Update dependency tox to v4.23.0 (#1935)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-19 14:06:09 -07:00
renovate[bot]
0cc4acd494
Update dependency black to v24.10.0 (#1939)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-19 14:05:26 -07:00
renovate[bot]
0d5bf1e467
Update dependency cryptography to v43.0.3 (#1942)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-19 14:05:04 -07:00
Jrnl Bot
85a98afcd9 Update changelog [ci skip] 2024-10-02 03:30:57 +00:00
Micah Jerome Ellison
96d89ca9d5
Add Python 3.13 support (#1930)
* Allow Python 3.13 in pyproject

* Add Python 3.13 to GitHub actions

* Run `poetry update`

* fix failing test

* update poetry.lock

* update poetry.lock again

---------

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2024-10-01 20:29:06 -07:00
Jonathan Wren
de79733957
Add config to pa11y to workaround github actions issue (#1933)
fixes #1932
2024-10-01 20:28:11 -07:00
Jrnl Bot
af1b9f128e Update changelog [ci skip] 2024-10-02 02:17:11 +00:00
renovate[bot]
5145190584
Update dependency tox to v4.21.0 (#1927)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-01 19:15:05 -07:00
renovate[bot]
314576ae13
Update dependency rich to v13.9.1 (#1931)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-01 19:14:38 -07:00
renovate[bot]
87c022780d
Update dependency cryptography to v43 (#1928)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-01 19:14:14 -07:00
Aaron Lichtman
a8bd0bcd44
Add calendar heatmap display format (#1759)
* Add calendar heatmap exporter

Fix #743

* Lint fixes

* More lint fixes

* Surface total number of entries per month in heatmap

* Refactoring

* More refactoring

* Resolve last lint error

* Unbump version

* Add calendar export test scaffolding

* WIP: Test debugging + scaffolding

* Remove broken tests

* Remove args from .vscode/launch.json

* Discard changes to tests/bdd/features/format.feature

* Remove extraneous vscode files

* move NestedDict to utils file

* run formatter

* fix import error

* Address lints

---------

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2024-10-01 18:59:26 -07:00
Jrnl Bot
2f0c5d2eb9 Update changelog [ci skip] 2024-10-01 01:25:58 +00:00
renovate[bot]
ae32ca6917
Update dependency rich to v13.8.1 (#1926)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:24:00 -07:00
renovate[bot]
5856517b0f
Update dependency poethepoet to v0.29.0 (#1925)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:23:21 -07:00
renovate[bot]
1586cc2b49
Update dependency pytest-xdist to v3.6.1 (#1897)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:22:27 -07:00
renovate[bot]
bcf41ddd17
Update dependency parse-type to v0.6.3 (#1922)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:21:23 -07:00
renovate[bot]
4017c4acb5
Update dependency keyring to v25.4.1 (#1924)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:20:46 -07:00
renovate[bot]
a646801c15
Update dependency black to v24.8.0 (#1923)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:19:54 -07:00
renovate[bot]
cb504c4bfb
Update dependency pytest-bdd to v7.3.0 (#1896)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:19:06 -07:00
Jrnl Bot
21e4552360 Update changelog [ci skip] 2024-10-01 01:18:27 +00:00
renovate[bot]
cdb9a220bd
Update dependency python-dateutil to v2.9.0 (#1898)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:16:48 -07:00
renovate[bot]
2d3809e6f7
Update dependency jinja2 to v3.1.4 (#1892)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:15:58 -07:00
renovate[bot]
0ff69bd24c
Update dependency mkdocs to v1.6.1 (#1895)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:15:15 -07:00
renovate[bot]
dec4855816
Update dependency requests to v2.32.3 (#1899)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:14:37 -07:00
renovate[bot]
89eaf3440a
Update dependency cryptography to v42.0.8 (#1904)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-30 18:13:58 -07:00
Jrnl Bot
7953309c78 Update changelog [ci skip] 2024-10-01 01:12:25 +00:00
renovate[bot]
17e1ba60e5
Update dependency ruff to v0.6.8 (#1900)
* Update dependency ruff to v0.6.8

* Run `ruff check .` instead of `ruff .` due to ruff error

* Preface ruff lint keys with .lint to address ruff deprecation warning

* Changes to appease ruff linter

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2024-09-30 18:10:49 -07:00
Jrnl Bot
4d84c491f1 Update changelog [ci skip] 2024-06-14 02:36:04 +00:00
Micah Jerome Ellison
79cf67eca6
Recommend pipx as easiest installation method for all OSes and remove warning about apt (#1889)
* Remove warning against installing pipx through apt (1886)
* Remove brew recommendation and consolidate pipx instructions (1888)
2024-06-13 19:34:31 -07:00
Jrnl Bot
c8c49b1ba2 Update changelog [ci skip] 2024-05-22 14:36:04 +00:00
renovate[bot]
8f2cb9c355
Update dependency poethepoet to v0.26.1 (#1862)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-22 07:34:33 -07:00
Jrnl Bot
9ac27704fb Update changelog [ci skip] 2024-05-22 14:32:05 +00:00
renovate[bot]
97b39dfd76
Update dependency tox to v4.15.0 (#1860)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-22 07:30:06 -07:00
Jrnl Bot
8fc158e35b Update changelog [ci skip] 2024-05-22 14:04:55 +00:00
renovate[bot]
83d4878044
Update dependency rich to v13.7.1 (#1864)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-22 07:03:04 -07:00
renovate[bot]
c9c71b40ef
Update dependency ruff to v0.4.4 (#1854)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-22 07:02:38 -07:00
Jrnl Bot
8cd4ac24a8 Update changelog [ci skip] 2024-05-22 14:00:33 +00:00
renovate[bot]
ca6b4a08a7
Update dependency cryptography to v42.0.7 (#1857)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-22 06:58:50 -07:00
Jrnl Bot
be9dbf52e0 Update changelog [ci skip] 2024-05-22 13:58:32 +00:00
renovate[bot]
4c4e36a534
Update dependency ruamel.yaml to v0.18.6 (#1855)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-22 06:55:55 -07:00
Jrnl Bot
7c4e3ad76e Update changelog [ci skip] 2024-05-22 13:55:04 +00:00
renovate[bot]
0c2c40d494
Update dependency keyring to v24.3.1 (#1863)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-22 06:53:26 -07:00
Jrnl Bot
ecf5f07dbb Update changelog [ci skip] 2024-05-21 04:18:03 +00:00
Ricardo Ruiz
8957ceb74d
Fix -contains to allow multiple terms with "OR" logic unless -and is added (#1890)
* 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>
2024-05-20 21:16:33 -07:00
Jrnl Bot
0deadc03c8 Update changelog [ci skip] 2024-05-20 15:08:46 +00:00
renovate[bot]
d5a5401db9
Update dependency black to v24.4.2 (#1856)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-20 08:07:06 -07:00
Manu Ebert
0aefdb3f21
Begrudgingly, change Twitter references to X (#1884)
Small fix: Change the twitter icon on the Docs landing page to X, and change the verbiage accordingly
2024-04-23 18:27:39 -07:00
Jrnl Bot
9ad1c9f26b Update changelog [ci skip] 2024-03-28 15:10:04 +00:00
Ben Beasley
48b61f6953
Support pytest_bdd 7.1.2 and later (#1878)
* 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>
2024-03-28 08:08:00 -07:00
Jrnl Bot
2af05e4008 Update changelog [ci skip] 2024-02-02 04:07:22 +00:00
renovate[bot]
a13abe446b
Update dependency black to v24 (#1849)
* 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>
2024-02-01 20:05:39 -08:00
renovate[bot]
5ce9d47126
Update dependency poethepoet to v0.24.4 (#1825)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 20:05:03 -08:00
Jrnl Bot
581af57bfd Update changelog [ci skip] 2024-02-02 03:49:26 +00:00
renovate[bot]
60abba3bfe
Update dependency ruamel.yaml to v0.18.5 (#1822)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:47:52 -08:00
Jrnl Bot
5323ca64fa Update changelog [ci skip] 2024-02-02 03:47:22 +00:00
renovate[bot]
1b2fa594e8
Update dependency ruff to v0.2.0 (#1824)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:45:51 -08:00
Jrnl Bot
36677fdccd Update changelog [ci skip] 2024-02-02 03:45:21 +00:00
renovate[bot]
896be7fb5f
Update dependency pytest-xdist to v3.5.0 (#1829)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:43:59 -08:00
Jrnl Bot
a2a6618959 Update changelog [ci skip] 2024-02-02 03:43:47 +00:00
renovate[bot]
39291bf1ce
Update dependency keyring to v24.3.0 (#1830)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:42:19 -08:00
Jrnl Bot
fbd468e03e Update changelog [ci skip] 2024-02-02 03:42:04 +00:00
renovate[bot]
d91c857fdc
Update dependency cryptography to v42 (#1850)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:40:28 -08:00
renovate[bot]
8eb124b54c
Update peter-evans/create-pull-request action to v6 (#1852)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:40:02 -08:00
Jrnl Bot
f3624a3fa2 Update changelog [ci skip] 2024-02-02 03:38:48 +00:00
renovate[bot]
de4cf5219e
Update nick-invision/retry action to v3 (#1851)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:37:06 -08:00
renovate[bot]
7fdc43b69d
Update dependency pa11y-ci to v3.1.0 (#1831)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:36:08 -08:00
renovate[bot]
df37641fa8
Update actions/setup-python action to v5 (#1848)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:35:05 -08:00
renovate[bot]
8edc14cfe7
Update actions/cache action to v4 (#1847)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:33:29 -08:00
renovate[bot]
8f2ac67659
Update dependency rich to v13.7.0 (#1833)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:32:36 -08:00
renovate[bot]
c5ba4cb198
Update dependency pytest-bdd to v7.0.1 (#1846)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:31:06 -08:00
renovate[bot]
d44515f764
Update dependency pytest to v7.4.4 (#1845)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:30:13 -08:00
Jrnl Bot
ccd68f1e78 Update changelog [ci skip] 2024-02-02 03:23:58 +00:00
renovate[bot]
fc16c6c3e8
Update dependency cryptography to v41.0.7 (#1837)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:22:31 -08:00
Jrnl Bot
b4e8bb0e12 Update changelog [ci skip] 2024-02-02 03:16:52 +00:00
renovate[bot]
5ca5ee6723
Update dependency jinja2 to v3.1.3 (#1844)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:15:11 -08:00
Jrnl Bot
ce50158167 Update changelog [ci skip] 2024-02-02 03:05:47 +00:00
renovate[bot]
d5f7182cf4
Update dependency tox to v4.12.1 (#1838)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 19:04:01 -08:00
Jrnl Bot
9d97df04a7 Update changelog [ci skip] 2024-02-02 02:54:59 +00:00
Micah Jerome Ellison
bf32d59844
Update release process to use Python 3.12 (#1820) 2024-02-01 18:53:27 -08:00
Jrnl Bot
caf3cdea3d Update changelog [ci skip] 2023-11-27 02:14:16 +00:00
utopiatopia
434c32003f
Document security risks of eavesdropping (#1834)
* Add security risks of eavesdropping
* Remove "Limitations" heading and dedent subheadings
* Move Plausible Deniability/Spying/Saved Passwords up above the long Shell History section

---------

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2023-11-26 18:12:26 -08:00
Micah Jerome Ellison
48a31e8154
v4.1 changelog cleanup (#1826)
* 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
2023-11-04 12:58:52 -07:00
Jrnl Bot
3fe3eda27b Update changelog [ci skip] 2023-11-04 19:37:42 +00:00
Jrnl Bot
65070cb675 Increment version to v4.1 2023-11-04 19:35:55 +00:00
Jrnl Bot
311d0b51b6 Update changelog [ci skip] 2023-10-31 01:55:19 +00:00
Jrnl Bot
aca0a185b7 Increment version to v4.1-beta2 2023-10-31 01:53:15 +00:00
Jrnl Bot
14bf9ac55f Update changelog [ci skip] 2023-10-31 01:28:20 +00:00
Micah Jerome Ellison
cf145123f5
Force rich to use color codes when pretty printing (#1821) 2023-10-30 18:25:49 -07:00
Jrnl Bot
c2a97f3100 Update changelog [ci skip] 2023-10-29 20:36:06 +00:00
Jrnl Bot
296c459252 Increment version to v4.1-beta 2023-10-29 20:34:08 +00:00
Jrnl Bot
a176913bda Update changelog [ci skip] 2023-10-29 20:29:54 +00:00
Micah Jerome Ellison
721167a079
Resolve parsedatetime "flag style" DeprecationWarning (#1818)
* 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
2023-10-29 13:27:53 -07:00
Jrnl Bot
7e94208574 Update changelog [ci skip] 2023-10-29 16:25:51 +00:00
renovate[bot]
ef016cfb76
Update dependency pytest to v7.4.3 (#1816)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-29 09:22:41 -07:00
renovate[bot]
c2cbf36a87
Update dependency poethepoet to v0.24.1 (#1806)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-29 09:22:21 -07:00
renovate[bot]
6379533065
Update dependency black to v23.10.1 (#1811)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-29 09:22:01 -07:00
renovate[bot]
eec83daaf5
Update dependency ruff to v0.1.3 (#1810)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-29 09:21:45 -07:00
Jrnl Bot
00a6724900 Update changelog [ci skip] 2023-10-29 16:15:25 +00:00
renovate[bot]
69e098d6e5
Update dependency pytest-bdd to v7 (#1807)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-29 09:13:09 -07:00
renovate[bot]
5bf24d6eac
Update dependency tzlocal to v5.2 (#1814)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-29 09:12:29 -07:00
Jrnl Bot
b6f1e76ae4 Update changelog [ci skip] 2023-10-29 16:10:57 +00:00
renovate[bot]
1fdb76008e
Update dependency ruamel.yaml to v0.18.3 (#1813)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-29 09:08:31 -07:00
Jrnl Bot
681b477543 Update changelog [ci skip] 2023-10-29 16:02:23 +00:00
renovate[bot]
c2fa27329c
Update dependency cryptography to v41.0.5 (#1815)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-29 08:59:51 -07:00
Jrnl Bot
299bf090fc Update changelog [ci skip] 2023-10-29 15:45:47 +00:00
Micah Jerome Ellison
a8f5f54a62
Add Python 3.12 support (#1761)
* 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
2023-10-29 08:43:43 -07:00
Jrnl Bot
75f97ce32f Update changelog [ci skip] 2023-10-17 15:36:22 +00:00
Micah Jerome Ellison
09a96e6db9
Set new required build fields in the ReadTheDocs config file (#1803)
* Set the OS in the ReadTheDocs build process

* Add required tools.python to ReadTheDocs config file

* Change Python version from number to a string
2023-10-17 08:33:58 -07:00
Jrnl Bot
f9558f960a Update changelog [ci skip] 2023-10-06 19:39:42 +00:00
renovate[bot]
1de94ca929
Update dependency ruff to v0.0.292 (#1797)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-06 12:37:35 -07:00
renovate[bot]
b639915fd4
Update dependency poethepoet to v0.24.0 (#1798)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-06 12:36:28 -07:00
renovate[bot]
12525e21ec
Update dependency tzlocal to v5.1 (#1804)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-06 12:35:42 -07:00
Jrnl Bot
3177578c64 Update changelog [ci skip] 2023-10-06 19:22:19 +00:00
renovate[bot]
4ea2fa8c31
Update dependency mkdocs to v1.5.3 (#1795)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-06 12:19:58 -07:00
Jrnl Bot
a1c24359d2 Update changelog [ci skip] 2023-10-06 18:53:56 +00:00
renovate[bot]
6529fbf211
Update dependency rich to v13.6.0 (#1794)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-06 11:51:52 -07:00
renovate[bot]
d881880c38
Update dependency ruamel.yaml to v0.17.35 (#1802)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-06 11:49:55 -07:00
Jrnl Bot
0a01420e9d Update changelog [ci skip] 2023-09-23 17:59:07 +00:00
renovate[bot]
c6f22a2753
Update dependency cryptography to v41.0.4 (#1796)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-23 10:56:52 -07:00
Jrnl Bot
c7b204022a Update changelog [ci skip] 2023-09-16 21:17:56 +00:00
renovate[bot]
1c7ad4d5bb
Update dependency ruff to v0.0.290 (#1792)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-16 14:15:36 -07:00
renovate[bot]
be4cc1abe8
Update dependency black to v23.9.1 (#1791)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-16 14:14:31 -07:00
Jrnl Bot
4969d28988 Update changelog [ci skip] 2023-09-09 22:46:45 +00:00
renovate[bot]
6962c399ea
Update dependency ruff to v0.0.287 (#1778)
* Update dependency ruff to v0.0.287

* add ruff target version to tailor linting to our required python versions

* fix linting issues

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2023-09-09 15:44:46 -07:00
Jrnl Bot
9533b55d8f Update changelog [ci skip] 2023-09-09 21:10:43 +00:00
renovate[bot]
c4d7f37cc2
Update dependency rich to v13.5.2 (#1776)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-09 14:08:20 -07:00
Micah Jerome Ellison
5c4724d524
Rename readthedocs.yml to .readthedocs.yaml as per current RTD spec (#1781) 2023-09-09 13:55:44 -07:00
Jrnl Bot
dfdd9b69cb Update changelog [ci skip] 2023-09-09 20:45:34 +00:00
renovate[bot]
475923d6d5
Update dependency poethepoet to v0.22.1 (#1785)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-09 13:43:25 -07:00
Jrnl Bot
2674639383 Update changelog [ci skip] 2023-09-09 20:42:04 +00:00
renovate[bot]
d2fc602618
Update dependency pytest to v7.4.2 (#1787)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-09 13:40:07 -07:00
renovate[bot]
85bd7d40a5
Update actions/checkout action to v4 (#1788)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-09 13:39:13 -07:00
Jrnl Bot
303ca98d0b Update changelog [ci skip] 2023-09-09 20:27:19 +00:00
renovate[bot]
c63367b067
Update dependency black to v23.9.0 (#1790)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-09 13:25:11 -07:00
Jrnl Bot
42ac0d33cc Update changelog [ci skip] 2023-09-09 20:17:25 +00:00
renovate[bot]
2a59c708b2
Update dependency tox to v4.11.3 (#1782)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-09 13:15:30 -07:00
Jrnl Bot
75b703d39f Update changelog [ci skip] 2023-08-03 19:18:09 +00:00
renovate[bot]
0f4fdf89b2
Update dependency cryptography to v41.0.3 (#1779)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-03 12:15:51 -07:00
Jrnl Bot
d2756db940 Update changelog [ci skip] 2023-08-03 19:12:35 +00:00
renovate[bot]
cfcbd8e6b7
Update dependency mkdocs to v1.5.2 (#1780)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-03 12:10:30 -07:00
Micah Jerome Ellison
cb69bb474c
Use rich instead of ansiwrap to wrap text (#1693) 2023-07-29 14:36:43 -07:00
Jrnl Bot
525cce3e92 Update changelog [ci skip] 2023-07-29 19:06:39 +00:00
renovate[bot]
cf6aef7ae0
Update dependency parse-type to v0.6.2 (#1762)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-29 12:04:26 -07:00
Jrnl Bot
b77ea37b2c Update changelog [ci skip] 2023-07-29 19:02:25 +00:00
renovate[bot]
488998cd33
Update dependency cryptography to v41.0.2 (#1770)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-29 12:00:16 -07:00
renovate[bot]
f5378dea74
Update dependency mkdocs to v1.5.1 (#1774)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-29 11:59:31 -07:00
Jrnl Bot
23b169708c Update changelog [ci skip] 2023-07-29 18:58:59 +00:00
renovate[bot]
b899130009
Update dependency rich to v13.5.0 (#1775)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-29 11:56:42 -07:00
Jrnl Bot
bb838ed83a Update changelog [ci skip] 2023-07-29 18:10:56 +00:00
renovate[bot]
4c53cd8830
Update dependency poethepoet to v0.21.1 (#1767)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-29 11:08:59 -07:00
renovate[bot]
1aa1ac0976
Update dependency black to v23.7.0 (#1769)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-29 11:08:10 -07:00
Jrnl Bot
f4db877ddd Update changelog [ci skip] 2023-07-29 17:58:19 +00:00
renovate[bot]
0da41a1328
Update dependency ruff to v0.0.280 (#1773)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-29 10:56:20 -07:00
Jrnl Bot
9970873ff5 Update changelog [ci skip] 2023-07-29 17:45:48 +00:00
renovate[bot]
129428ef80
Update dependency tox to v4.6.4 (#1765)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-29 10:43:36 -07:00
Jrnl Bot
e1501fd4d1 Update changelog [ci skip] 2023-07-15 19:37:08 +00:00
Micah Jerome Ellison
34c7903300
Replace flake8 and isort with ruff linter and add black --check to linting step (#1763)
* 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
2023-07-15 12:35:10 -07:00
Jrnl Bot
dd09ece4e7 Update changelog [ci skip] 2023-07-15 19:11:58 +00:00
Micah Jerome Ellison
c6b9114c42
Add note about messages going to stderr and the implication for piping (#1768)
* Add note about messages going to STDERR and the implication for piping

* Minor wording change

* Wording and capitalization changes
2023-07-15 12:09:18 -07:00
Jrnl Bot
7a9bc929a5 Update changelog [ci skip] 2023-06-24 18:31:50 +00:00
renovate[bot]
235ba679e3
Update dependency keyring to v24.2.0 (#1760)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-24 11:29:56 -07:00
Jrnl Bot
32f7b9de62 Update changelog [ci skip] 2023-06-24 18:28:06 +00:00
renovate[bot]
9735a60883
Update dependency cryptography to v41 (#1753)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-24 11:25:40 -07:00
renovate[bot]
b4088bf8b8
Update dependency tox to v4.6.3 (#1751)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-24 11:24:15 -07:00
renovate[bot]
a1de9589b5
Update dependency ruamel.yaml to v0.17.32 (#1752)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-24 11:23:01 -07:00
renovate[bot]
875b6d2b35
Update dependency rich to v13.4.2 (#1754)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-24 11:21:28 -07:00
renovate[bot]
12355e087c
Update dependency pytest to v7.4.0 (#1757)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-24 11:21:09 -07:00
renovate[bot]
6e8d6e9aee
Update dependency keyring to v24 (#1758)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-24 11:19:31 -07:00
Jrnl Bot
2a05aad0e9
Update changelog [ci skip] 2023-06-20 16:53:52 -07:00
Jrnl Bot
4f1a21819d Increment version to v4.0.1 2023-06-20 23:39:40 +00:00
Jrnl Bot
12e663ee93 Update changelog [ci skip] 2023-05-27 20:02:06 +00:00
renovate[bot]
9edc7c5cc0
Update dependency ruamel.yaml to v0.17.28 (#1749)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-27 12:59:47 -07:00
Jrnl Bot
793a5e22c5 Update changelog [ci skip] 2023-05-22 20:16:54 +00:00
renovate[bot]
10cf68161e
Update dependency requests to v2.31.0 (#1748)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-22 13:14:18 -07:00
Jrnl Bot
21c4aa0b3a Update changelog [ci skip] 2023-05-20 23:37:04 +00:00
Jrnl Bot
649254d0ac Increment version to v4.0.1-beta 2023-05-20 23:34:50 +00:00
Jrnl Bot
f5dc5fbae0 Update changelog [ci skip] 2023-05-20 23:31:48 +00:00
renovate[bot]
5124a805c8
Update dependency ruamel.yaml to v0.17.26 (#1746)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 16:20:47 -07:00
Jrnl Bot
982e597742 Update changelog [ci skip] 2023-05-20 23:15:49 +00:00
Micah Jerome Ellison
4a7057c038
Refactor --template code (#1711)
* 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>
2023-05-20 16:13:24 -07:00
renovate[bot]
78d11d74bd
Update dependency flake8-simplify to v0.20.0 (#1716)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 16:12:26 -07:00
Jrnl Bot
b1843ab14b Update changelog [ci skip] 2023-05-20 23:05:54 +00:00
Jonathan Wren
4cb5d1e436
fix some linting issues for failing PR (#1745) 2023-05-20 16:03:46 -07:00
renovate[bot]
959e18ad91
Update peter-evans/create-pull-request action to v5 (#1719)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 16:02:35 -07:00
Jrnl Bot
4292d85a22 Update changelog [ci skip] 2023-05-20 22:57:33 +00:00
Jonathan Wren
9f4ca2683f
run pipeline tests weekly (#1744) 2023-05-20 15:55:25 -07:00
Jrnl Bot
3e44027ab5 Update changelog [ci skip] 2023-05-20 22:46:18 +00:00
Jonathan Wren
98d2a3b3ec
fix linting issue from shellcheck (#1743) 2023-05-20 15:43:52 -07:00
Jrnl Bot
0d8fc9028c Update changelog [ci skip] 2023-05-20 22:25:05 +00:00
renovate[bot]
f5e5d817be
Update dependency requests to v2.30.0 (#1728)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 15:22:31 -07:00
renovate[bot]
d5f00edb9d
Update dependency rich to v13.3.5 (#1729)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 15:20:51 -07:00
renovate[bot]
6e9fade8dd
Update dependency tox to v4.5.1 (#1727)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 15:19:30 -07:00
Jrnl Bot
7045e97a24 Update changelog [ci skip] 2023-05-20 22:17:51 +00:00
renovate[bot]
fdc87ff8c4
Update dependency mkdocs to v1.4.3 (#1733)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 15:15:42 -07:00
Jrnl Bot
81313c2445 Update changelog [ci skip] 2023-05-20 22:12:36 +00:00
renovate[bot]
0b8b4244bd
Update dependency poethepoet to v0.20.0 (#1735)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 15:10:16 -07:00
Jrnl Bot
7a8b86aadb Update changelog [ci skip] 2023-05-20 22:10:01 +00:00
renovate[bot]
1f59c15f5e
Update dependency pytest-xdist to v3.3.1 (#1740)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 15:07:47 -07:00
renovate[bot]
da0c49da83
Update dependency tzlocal to v5 (#1741)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-20 15:07:06 -07:00
Micah Jerome Ellison
8f2eb27793
Add flakeheaven_cache/ to gitignore and fix typo in comment (#1731) 2023-05-20 14:57:24 -07:00
Jonathan Wren
a1a68f7eea
clean up changelog a bit 2023-05-20 14:50:41 -07:00
Jrnl Bot
cd850c068d Update changelog [ci skip] 2023-05-20 20:37:30 +00:00
Jrnl Bot
e987e34c78 Increment version to v4.0 2023-05-20 20:35:57 +00:00
Jrnl Bot
53342c944e Update changelog [ci skip] 2023-05-07 00:04:57 +00:00
Jonathan Wren
0b55c477e1
Lock ruamel.yaml version until bug is fixed (#1738) 2023-05-06 17:02:55 -07:00
Jrnl Bot
7e09c4eb66 Update changelog [ci skip] 2023-04-29 22:53:16 +00:00
Jrnl Bot
adeb1acced Increment version to v4.0-beta3 2023-04-29 22:51:01 +00:00
Micah Jerome Ellison
95836a7dd1
Only read text files that look like entries when opening folder journal (#1697)
* 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>
2023-04-29 15:49:41 -07:00
Jrnl Bot
88aa2491b0 Update changelog [ci skip] 2023-04-29 18:59:52 +00:00
CoffeeOrDeath
73aa146f8a
Update contributing.md links in documentation (#1726)
* 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
2023-04-29 11:57:57 -07:00
Jrnl Bot
7d237c887f Update changelog [ci skip] 2023-04-22 20:49:03 +00:00
Jrnl Bot
8d95e0bfe9 Increment version to v4.0-beta2 2023-04-22 20:46:35 +00:00
Jrnl Bot
bd147fa285 Update changelog [ci skip] 2023-04-22 20:40:18 +00:00
renovate[bot]
ab9128ffb6
Update dependency tox to v4.4.12 (#1712)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-22 13:38:15 -07:00
Jrnl Bot
d2c92511ff Update changelog [ci skip] 2023-04-22 20:37:56 +00:00
renovate[bot]
9bd16473c9
Update dependency rich to v13.3.4 (#1713)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-22 13:35:27 -07:00
renovate[bot]
ad3b8396be
Update dependency flake8-type-checking to v2.4.0 (#1714)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-22 13:34:15 -07:00
Jrnl Bot
8a22f9db56 Update changelog [ci skip] 2023-04-22 20:33:52 +00:00
renovate[bot]
b00f5f1531
Update dependency black to v23.3.0 (#1715)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-22 13:31:16 -07:00
Jrnl Bot
fc83bee80b Update changelog [ci skip] 2023-04-22 20:21:49 +00:00
Zhizhen He
0b64d50f4b
fix typo (#1718) 2023-04-22 13:19:15 -07:00
Jrnl Bot
ea6a5da3eb Update changelog [ci skip] 2023-04-22 19:41:20 +00:00
renovate[bot]
5bcdcdd5c6
Update dependency pytest to v7.3.1 (#1720)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-22 12:39:25 -07:00
renovate[bot]
9581b1b81a
Update dependency flakeheaven to v3.3.0 (#1722)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-22 12:37:48 -07:00
Jrnl Bot
10216988d4 Update changelog [ci skip] 2023-04-22 19:32:57 +00:00
renovate[bot]
745373df6a
Update dependency cryptography to v40.0.2 (#1723)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-22 12:30:17 -07:00
Jrnl Bot
23551a379b Update changelog [ci skip] 2023-03-25 23:06:24 +00:00
Jrnl Bot
deef870213 Increment version to v4.0-beta 2023-03-25 23:04:23 +00:00
Jrnl Bot
37b731ff14 Update changelog [ci skip] 2023-03-25 19:34:32 +00:00
Jonathan Wren
3c923ae943
Allow combinations of --change-time, --delete, and --edit while correctly counting the number of entries affected (#1669)
* 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>
2023-03-25 12:32:25 -07:00
Jrnl Bot
b3c6f90a35 Update changelog [ci skip] 2023-03-25 18:49:16 +00:00
Aaron Lichtman
a2b217fdfc
Add ability to use template with --template (#1667)
* Add ability to pass template path with --template

Update jrnl/args.py

* Fix tests
2023-03-25 11:47:00 -07:00
Jrnl Bot
0725ea6b87 Update changelog [ci skip] 2023-03-25 18:18:19 +00:00
renovate[bot]
dad2744e71
Update dependency cryptography to v40 (#1710)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-25 11:15:48 -07:00
Jrnl Bot
94f079293b Update changelog [ci skip] 2023-03-25 17:55:18 +00:00
renovate[bot]
55f7328b3e
Update dependency poethepoet to v0.19.0 (#1709)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-25 10:53:19 -07:00
Jrnl Bot
5a74b0e722 Update changelog [ci skip] 2023-03-18 20:00:55 +00:00
renovate[bot]
3764946dfe
Update dependency pytest-xdist to v3.2.1 (#1705)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-18 12:58:47 -07:00
renovate[bot]
1b7afe588b
Update dependency ipdb to v0.13.13 (#1703)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-18 12:57:47 -07:00
renovate[bot]
f7e2a59332
Update dependency flake8-type-checking to v2.3.1 (#1702)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-18 12:56:38 -07:00
renovate[bot]
fc9def0879
Update dependency pytest to v7.2.2 (#1704)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-18 12:56:10 -07:00
renovate[bot]
7cd301fcbf
Update dependency rich to v13.3.2 (#1706)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-18 12:55:42 -07:00
renovate[bot]
16fec7c87f
Update dependency tox to v4.4.7 (#1707)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-18 12:53:56 -07:00
Jrnl Bot
a7021b03e7 Update changelog [ci skip] 2023-03-18 19:47:29 +00:00
renovate[bot]
d24a73e349
Update dependency cryptography to v39.0.2 (#1701)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-18 12:45:21 -07:00
Jrnl Bot
d67310ec90 Update changelog [ci skip] 2023-03-18 19:39:00 +00:00
renovate[bot]
0f203fb198
Update dependency tzlocal to v4.3 (#1708)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-18 12:36:58 -07:00
Jrnl Bot
aa8433f881 Update changelog [ci skip] 2023-03-04 20:53:29 +00:00
Micah Jerome Ellison
e54908be0d
Document -tagged, -not -tagged, and -not -starred in command line reference (#1684) 2023-03-04 12:51:12 -08:00
Jrnl Bot
22bf6595da Update changelog [ci skip] 2023-03-04 20:47:31 +00:00
Micah Jerome Ellison
427485a1d7
Add message with config location and docs location when installation is complete (#1695) 2023-03-04 12:45:37 -08:00
Jrnl Bot
23150ddb31 Update changelog [ci skip] 2023-03-04 20:39:09 +00:00
Micah Jerome Ellison
1a67fd5dec
Use pytest-bdd 6 (#1685)
* 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>
2023-03-04 12:37:06 -08:00
Micah Jerome Ellison
2d0b15ea7b
Update documentation front page text (#1698)
* 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>
2023-03-04 12:20:20 -08:00
Jrnl Bot
611f3af772 Update changelog [ci skip] 2023-02-25 23:32:54 +00:00
Micah Jerome Ellison
e6804f1627
Prompt to include colors in config when first running jrnl (#1687)
* 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>
2023-02-25 15:30:25 -08:00
Jrnl Bot
fecd696b2a Update changelog [ci skip] 2023-02-25 20:31:52 +00:00
Micah Jerome Ellison
3c87111710
Save empty journal on install instead of just creating a zero-length file (#1690)
* 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
2023-02-25 12:29:43 -08:00
Jrnl Bot
592e7bcf27 Update changelog [ci skip] 2023-02-25 20:18:29 +00:00
Micah Jerome Ellison
d81b5ad955
Support mkdocs 1.4.2 and fix its missing breadcrumb (#1691)
* 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
2023-02-25 12:16:33 -08:00
Micah Jerome Ellison
fcac94a30e
Document temporary file extension behavior when using template (#1686)
* 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
2023-02-25 12:15:52 -08:00
Giuseppe D'Andrea
18397b13eb
Update documentation about privacy and security in VSCode (#1680)
* docs: vscode file history

* docs: vscode unsaved files

* Edited for tone

---------

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2023-02-21 08:45:53 -08:00
Jrnl Bot
b4da3a51f7 Update changelog [ci skip] 2023-02-11 20:40:50 +00:00
Briscoooe
b41a988d6f
Don't save templated journal entries if the received raw text is the same as the template itself (#1653) 2023-02-11 12:38:21 -08:00
David Isaksson
6c6937c507
Add documentation about information leaks in Vim/Neovim (#1674)
* 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>
2023-02-11 12:16:31 -08:00
Jrnl Bot
6b179e673b Update changelog [ci skip] 2023-02-11 20:12:27 +00:00
Giuseppe D'Andrea
2d1a52afe5
Update documentation on temporary files naming (#1673) 2023-02-11 12:10:18 -08:00
Jrnl Bot
d4ce2a84cf Update changelog [ci skip] 2023-01-28 19:47:17 +00:00
Ciaran Concannon
7bd15d12ad
Search for entries with no tags or stars with -not -starred and -not -tagged (#1663)
* Allow for `-not -starred` to search for unstarred entries

* Add `-tagged` and `-not -tagged` functionality
2023-01-28 11:45:01 -08:00
Jrnl Bot
17c987c605 Update changelog [ci skip] 2023-01-14 22:44:27 +00:00
Jonathan Wren
fff05eb646
Refactor flow for easier access to some files (avoid things like jrnl.Journal.Journal and jrnl.jrnl co-existing) (#1662)
* 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
2023-01-14 14:42:29 -08:00
Jrnl Bot
7be67accc1 Update changelog [ci skip] 2023-01-14 21:24:31 +00:00
outa
a13726d4c5
Add more type hints (#1642) 2023-01-14 13:22:31 -08:00
Peter Conrad
9547411390
Update docs to include time and title in arguments with --edit (#1657) 2023-01-07 14:04:33 -08:00
Jrnl Bot
120c54a29e Update changelog [ci skip] 2023-01-07 22:01:41 +00:00
renovate[bot]
a6f2d34b7e
Update dependency rich to v13 (#1654)
* Update dependency rich to v13

* Update pyproject.toml

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2023-01-07 13:59:40 -08:00
Jonathan Ballet
458faff8a8
Fix markup in "Advanced Usage" doc (#1655)
* Fix YAML indentiation in a configuration example
* Improve Markdown markup
2023-01-07 13:58:49 -08:00
Jrnl Bot
2cec8bdc5b Update changelog [ci skip] 2023-01-07 21:41:17 +00:00
Jonathan Wren
8da6029624
Update copyright notices for 2023 (#1660)
* update copyright notice for 2023

* standardize whitespace after copyright notice
2023-01-07 13:39:07 -08:00
Micah Jerome Ellison
9274ab16ed
Add basic template test (#1659)
* Add very basic test template
* Ensure that templates are copied to temporary test workspace
* Add basic template test
* Update copyright for this new file
2023-01-07 13:37:43 -08:00
Jrnl Bot
d5d39971b4 Update changelog [ci skip] 2023-01-07 20:53:14 +00:00
Jonathan van der Steege
907566b39f
Add tag to XML file when edited DayOne entry and is searchable afterward (#1648)
* 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
2023-01-07 12:51:07 -08:00
Jrnl Bot
7229d77bda Update changelog [ci skip] 2023-01-07 19:48:26 +00:00
Jonathan van der Steege
d94325127f
Update version key in config file after version changes (#1646) 2023-01-07 11:46:12 -08:00
Jrnl Bot
fe08cfd3ab Update changelog [ci skip] 2022-11-19 21:41:41 +00:00
Jonathan Wren
fcc8d8e3fa
Rework Encryption to enable future support of other encryption methods (#1602)
- 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>
2022-11-19 13:39:39 -08:00
Jrnl Bot
e6e08e5d3e Update changelog [ci skip] 2022-11-05 23:07:28 +00:00
Micah Jerome Ellison
92a8ec4f68
Remove Windows 7 known issue since jrnl no longer supports (#1636) 2022-11-05 16:05:36 -07:00
Jrnl Bot
b7a3110e7e Update changelog [ci skip] 2022-11-05 22:58:54 +00:00
Jonathan Wren
b508ed6c9a
Add simplify plugin to linting checks (#1630)
* add simplify plugin for flakeheaven

* update lock file

* fix linting issues in current codebase
2022-11-05 15:56:46 -07:00
Jrnl Bot
1e69495728 Update changelog [ci skip] 2022-11-05 22:31:41 +00:00
outa
30b41fdb88
Add type hints (#1614)
* Add type hints

* Fix linters

* Add remaining type hints

* Fix type-checking linter

* Update jrnl/DayOneJournal.py

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2022-11-05 15:29:50 -07:00
Jonathan Wren
c1eb0c54a3
Add type-checking plugin to linting checks (#1629)
* add type-checking plugin for flakeheaven

* update lock file

* fix type-checking issues in current codebase

* run linters
2022-11-03 07:18:35 -07:00
Jrnl Bot
cb7e0ed289 Update changelog [ci skip] 2022-11-03 02:55:34 +00:00
Micah Jerome Ellison
e6130dbf4a
Resolve failing GitHub Actions linting by replacing deprecated set-output command (#1632)
* Replace deprecated set-output command
* Resolve SC2086 - double quote to prevent globbing and word splitting
* fix quotes in output command

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2022-11-02 19:53:32 -07:00
Jrnl Bot
8e482321f2 Update changelog [ci skip] 2022-11-01 23:52:21 +00:00
Jonathan Wren
8ad9e2bdd6
Fix bug where changelog is always slightly out of date on release tags (#1631)
* 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
2022-11-01 16:50:25 -07:00
Jonathan Wren
51e9ce5638
Move existing linting into flakeheaven (#1628)
* 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
2022-10-31 09:31:17 -07:00
Jrnl Bot
9150f07984 Update changelog [ci skip] 2022-10-31 15:58:15 +00:00
Jonathan Wren
cd47070894
Add rich handler for better-formatted debug logging (#1627) 2022-10-31 08:55:23 -07:00
Micah Jerome Ellison
44e2ace833
Add double encryption test (#1626) 2022-10-30 13:06:54 -07:00
Jrnl Bot
5cf9311502 Update changelog [ci skip] 2022-10-29 21:39:27 +00:00
Micah Jerome Ellison
74b7ac834e
Drop Python 3.9 and use Python 3.11 official release (#1611)
* 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
2022-10-29 14:36:50 -07:00
Jonathan Wren
a77a3d5a56
Replace flake8 with flakeheaven in linting steps (#1625)
* 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>
2022-10-29 14:21:11 -07:00
Jonathan Wren
847dadac5d
Manual change to changelog [ci skip]
- Document that v3.0 had breaking changes with emoji for emphasis
2022-10-29 12:40:31 -07:00
Jrnl Bot
60590e0c49 Update changelog [ci skip] 2022-10-29 19:27:02 +00:00
Jrnl Bot
415fc336ec Increment version to v3.3 2022-10-29 19:19:53 +00:00
Jrnl Bot
81771eff4f Update changelog [ci skip] 2022-10-29 19:16:11 +00:00
Micah Jerome Ellison
6f9a3eb536
Document that editors must be blocking processes (#1624)
* 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
2022-10-29 12:14:28 -07:00
Micah Jerome Ellison
c6479c70c1 Add contextual link to external editors page from overview 2022-10-29 11:51:41 -07:00
Jrnl Bot
6cd8c35598 Update changelog [ci skip] 2022-10-22 22:40:26 +00:00
Jrnl Bot
ffdd4f923d Increment version to v3.3-beta2 2022-10-22 22:38:31 +00:00
Jrnl Bot
c32acd0123 Update changelog [ci skip] 2022-10-22 22:36:58 +00:00
Jonathan Wren
63850a33c1
Fix bug for new --list --format options when no default journal is specified (#1621)
* 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>
2022-10-22 15:35:16 -07:00
Jrnl Bot
619de775fd Update changelog [ci skip] 2022-10-22 21:30:18 +00:00
DSiekmeier
48c528d76a
Remove wrong option in configuration file reference (#1618) 2022-10-22 14:28:34 -07:00
Jrnl Bot
52f82fc855 Update changelog [ci skip] 2022-10-08 20:51:42 +00:00
Jrnl Bot
41e5d5ffff Increment version to v3.3-beta 2022-10-08 20:49:59 +00:00
outa
d7242d81a4
Don't create empty file when attempting a YAML export to a non-existing folder (#1600)
* Call `export_journal` before opening file handle
* Use correct exporter class
* Fix unit test
2022-10-08 13:48:29 -07:00
Jrnl Bot
a925c81ba8 Update changelog [ci skip] 2022-10-08 20:43:20 +00:00
Micah Jerome Ellison
ceff398a01
Change default config to use journal key instead of journal name as key for file path (#1594) 2022-10-08 13:41:22 -07:00
Jrnl Bot
dd7f59cef7 Update changelog [ci skip] 2022-10-08 19:42:07 +00:00
Jonathan Wren
ff24ee604d
Update .gitignore (#1604)
* add ignore for directories used by this project

* update name of asdf version file (had a typo)
2022-10-08 12:40:27 -07:00
Jrnl Bot
560d076a5f Update changelog [ci skip] 2022-09-24 19:48:37 +00:00
Kevin
2df7acf488
Add machine readable --list output (#1592)
* 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
2022-09-24 12:46:49 -07:00
dependabot[bot]
057f31407a
Bump mako from 1.2.1 to 1.2.2 (#1598)
Bumps [mako](https://github.com/sqlalchemy/mako) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/sqlalchemy/mako/releases)
- [Changelog](https://github.com/sqlalchemy/mako/blob/main/CHANGES)
- [Commits](https://github.com/sqlalchemy/mako/commits)

---
updated-dependencies:
- dependency-name: mako
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-17 12:04:36 -07:00
Jonathan Wren
e9be61cae2
Change default timestamp to %F %r (#1595)
Fixes #1100
2022-09-17 12:02:52 -07:00
Jrnl Bot
66d26cfed6 Update changelog [ci skip] 2022-09-10 18:50:10 +00:00
Kevin
b5a22379b8
Update YAML export description in docs (#1591) 2022-09-10 11:48:20 -07:00
Jrnl Bot
405e0c2199 Update changelog [ci skip] 2022-09-03 21:23:14 +00:00
Jonathan Wren
bd02c52d5a
Fix Docs Accessibility Testing (#1588)
* update run_shell task to use newer python

* add shell arg back

* make tests run when certain files change
2022-09-03 14:21:27 -07:00
Jrnl Bot
8032aa9f2f Update changelog [ci skip] 2022-09-03 20:25:31 +00:00
renovate[bot]
a95cd333d5
Update dependency typed.js to v2.0.12 (#1578)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-03 13:23:37 -07:00
renovate[bot]
0618ff57e4
Update dependency jinja2 to v3.1.2 (#1579)
* Update dependency jinja2 to v3.1.2

* Remove old unneeded comment from requirements.txt

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2022-09-03 13:22:46 -07:00
Jrnl Bot
a3ce9bdb55 Update changelog [ci skip] 2022-09-03 20:18:05 +00:00
renovate[bot]
43d7dc026c
Pin dependencies (#1577)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-03 13:16:28 -07:00
renovate[bot]
0d7acafc44
Update actions/checkout action to v3 (#1582)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-03 13:16:18 -07:00
Jrnl Bot
080fcde440 Update changelog [ci skip] 2022-09-03 20:13:58 +00:00
renovate[bot]
adc505cef9
Update peter-evans/create-pull-request action to v4 (#1585)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-03 13:12:12 -07:00
renovate[bot]
cc703ae3c6
Update actions/cache action to v3 (#1581)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-03 13:11:08 -07:00
Jrnl Bot
7b2e2de3df Update changelog [ci skip] 2022-09-03 20:04:21 +00:00
renovate[bot]
06a5dab129
Update actions/setup-python action to v4 (#1583)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-03 13:02:37 -07:00
Jrnl Bot
4d4f328527 Update changelog [ci skip] 2022-09-03 19:51:36 +00:00
Jonathan Wren
49fc1e4e40
Update to use renamed flag for brew bump-formula-pr 2022-09-03 12:49:43 -07:00
Paul Jimenez
b2f53d48f7
Add hint for how to get vi to go to end-of-file (#1563) 2022-09-03 12:48:37 -07:00
Jrnl Bot
75008dcb1a Update changelog [ci skip] 2022-09-03 19:23:33 +00:00
renovate[bot]
37af7b8db6
Replace Dependabot with Renovate (#1575)
* Add renovate.json

* move renovate config file into .github dir

* update config to match dependabot

* remove old dependabot config

* update prhourlylimit setting for renovate

* fix typo

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2022-09-03 12:21:52 -07:00
Jrnl Bot
8a7225a249 Update changelog [ci skip] 2022-09-03 19:09:06 +00:00
Jrnl Bot
55e0162a87 Increment version to v3.2 2022-09-03 19:07:07 +00:00
Jonathan Wren
76392620be
fix typo (#1569) 2022-08-27 14:18:06 -07:00
Jrnl Bot
0e2d16982b Update changelog [ci skip] 2022-08-27 21:12:47 +00:00
Jonathan Wren
fbb819d7a0
Update issue templates from markdown into yaml forms (#1567)
* 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
2022-08-27 14:11:06 -07:00
Jrnl Bot
11119a6143 Update changelog [ci skip] 2022-08-27 20:57:48 +00:00
Micah Jerome Ellison
57adea3cc1
Remove note about gh-pages branch that we no longer use (#1566) 2022-08-27 13:56:03 -07:00
Jrnl Bot
a923be53cd Update changelog [ci skip] 2022-08-27 19:42:54 +00:00
Jrnl Bot
a107c868a0 Increment version to v3.2-beta 2022-08-27 19:40:35 +00:00
Jrnl Bot
3efe09ad72 Update changelog [ci skip] 2022-08-27 19:35:23 +00:00
Micah Jerome Ellison
f65f07dbcb
Suppress "Entry added" message if using default journal (#1561)
* 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
2022-08-27 12:33:44 -07:00
Jrnl Bot
bb6491bd06 Update changelog [ci skip] 2022-08-27 19:16:18 +00:00
Kevin
0cc771f633
Add message showing the number of search results (#1524)
* 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
2022-08-27 12:13:57 -07:00
Jrnl Bot
0fddb07c09 Update changelog [ci skip] 2022-08-27 19:05:08 +00:00
Jonathan Wren
3c50b01c23
take out old help text from pipeline config (#1565)
These used to be needed because the `type` field didn't exist.
2022-08-27 12:03:01 -07:00
Jrnl Bot
72d1a044d9 Update changelog [ci skip] 2022-08-21 22:23:36 +00:00
Jrnl Bot
b26fdb424b Increment version to v3.1 2022-08-21 22:22:00 +00:00
Jrnl Bot
1f58452b76 Update changelog [ci skip] 2022-08-21 21:52:58 +00:00
Janek
5a5d31f213
jrnl/args.py: reformat contributor appreciation (#1556) 2022-08-21 14:51:23 -07:00
Jrnl Bot
8948334d5d Update changelog [ci skip] 2022-08-21 21:19:21 +00:00
Jonathan Wren
4eb9c9fdec
Clean up copyright notices and version screen (#1553)
* 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
2022-08-21 14:17:35 -07:00
Jrnl Bot
5dcc721f15 Update changelog [ci skip] 2022-08-21 21:02:05 +00:00
Jonathan Wren
803b3956fa
Add actionlint to testing pipelines (#1555)
* 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
2022-08-21 13:59:45 -07:00
Jrnl Bot
fd981216da Update changelog [ci skip] 2022-08-21 20:49:49 +00:00
Jonathan Wren
671f403602
Fix docs pipeline, make docs tests easier to run locally and on different OSes (#1554)
* 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>
2022-08-21 13:47:25 -07:00
Jrnl Bot
33607acbb6 Update changelog [ci skip] 2022-08-13 21:05:29 +00:00
Jrnl Bot
6f4e669e0d Increment version to v3.1-beta2 2022-08-13 21:03:51 +00:00
Jrnl Bot
a6756ebe0f Update changelog [ci skip] 2022-08-13 20:50:33 +00:00
dependabot[bot]
4b53d16ea0
Bump keyring from 23.7.0 to 23.8.2 (#1551)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.7.0 to 23.8.2.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.7.0...v23.8.2)

---
updated-dependencies:
- dependency-name: keyring
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-13 13:48:38 -07:00
Jrnl Bot
5387763169 Update changelog [ci skip] 2022-08-13 20:04:09 +00:00
Jonathan van der Steege
fb473007da
Export to file(s) when first line/title of an entry is very long (#1527) 2022-08-13 13:02:19 -07:00
Jrnl Bot
c92ee47632 Update changelog [ci skip] 2022-08-13 19:49:55 +00:00
dependabot[bot]
611d6d7b11
Bump pyproject-flake8 from 0.0.1a4 to 0.0.1a5 (#1552)
Bumps [pyproject-flake8](https://github.com/csachs/pyproject-flake8) from 0.0.1a4 to 0.0.1a5.
- [Release notes](https://github.com/csachs/pyproject-flake8/releases)
- [Commits](https://github.com/csachs/pyproject-flake8/compare/v0.0.1a4...v0.0.1a5)

---
updated-dependencies:
- dependency-name: pyproject-flake8
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-13 12:47:57 -07:00
Jrnl Bot
6f4df4b55e Update changelog [ci skip] 2022-07-30 19:52:53 +00:00
Jrnl Bot
6ade0da597 Increment version to v3.1-beta 2022-07-30 19:51:10 +00:00
Jrnl Bot
a78632768c Update changelog [ci skip] 2022-07-30 19:48:19 +00:00
outa
62f65ce3b9
Update tzlocal to v4.x and remove pytz dependency (#1528)
* Update tzlocal to v4.x and remove pytz dependency
* Avoid `unwrap_shim` method
* Remove upper bound of tzlocal version
2022-07-30 12:46:43 -07:00
Jrnl Bot
049d2a72c8 Update changelog [ci skip] 2022-07-30 19:46:19 +00:00
dependabot[bot]
94d126b0c8
Bump poethepoet from 0.15.0 to 0.16.0 (#1542)
Bumps [poethepoet](https://github.com/nat-n/poethepoet) from 0.15.0 to 0.16.0.
- [Release notes](https://github.com/nat-n/poethepoet/releases)
- [Commits](https://github.com/nat-n/poethepoet/compare/v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: poethepoet
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-30 12:43:57 -07:00
Jrnl Bot
e233ab4a74 Update changelog [ci skip] 2022-07-30 19:35:48 +00:00
dependabot[bot]
506cc664b2
Bump rich from 12.4.4 to 12.5.1 (#1538)
Bumps [rich](https://github.com/willmcgugan/rich) from 12.4.4 to 12.5.1.
- [Release notes](https://github.com/willmcgugan/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](https://github.com/willmcgugan/rich/compare/v12.4.4...v12.5.1)

---
updated-dependencies:
- dependency-name: rich
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-30 12:34:09 -07:00
Jrnl Bot
2d15a7a5cf Update changelog [ci skip] 2022-07-30 19:23:51 +00:00
Jonathan van der Steege
80bfff384e
Add linewrap option 'auto' (#1507)
* 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
2022-07-30 12:22:04 -07:00
dependabot[bot]
252c63f4dd
Bump yq from 3.0.2 to 3.1.0 (#1546)
Bumps [yq](https://github.com/kislyuk/yq) from 3.0.2 to 3.1.0.
- [Release notes](https://github.com/kislyuk/yq/releases)
- [Changelog](https://github.com/kislyuk/yq/blob/develop/Changes.rst)
- [Commits](https://github.com/kislyuk/yq/compare/v3.0.2...v3.1.0)

---
updated-dependencies:
- dependency-name: yq
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-30 12:20:50 -07:00
Kevin
08c366d950
Fixed index out of range error in fancy exporter (#1522) 2022-07-30 12:16:56 -07:00
Jrnl Bot
7b5106dd08 Update changelog [ci skip] 2022-07-30 19:03:58 +00:00
dependabot[bot]
24ee35b95b
Bump keyring from 23.6.0 to 23.7.0 (#1539)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.6.0 to 23.7.0.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.6.0...v23.7.0)

---
updated-dependencies:
- dependency-name: keyring
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-30 12:02:02 -07:00
Jonathan Wren
ec8bbd2187
update formatting function to better account for indenting (#1541) 2022-07-16 14:45:13 -07:00
Jrnl Bot
e695180049 Update changelog [ci skip] 2022-07-16 21:22:57 +00:00
Jonathan van der Steege
3a5316cedc
Check for duplicate keys in config file (#1511)
* Check for duplicate keys in config file
* Corrected BDD tests
* Unneeded check removed
* Make use of ruamel DuplicateKeyError exception
* Remove unneeded import and function
* slightly reword warning message
* fix merge conflicts
* update tests

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2022-07-16 14:21:21 -07:00
Jonathan Wren
c45bed7f6c
Disable gherkin reporter to fix failing test suite (#1540) 2022-07-16 14:13:48 -07:00
Jrnl Bot
ca1f2a76d8 Update changelog [ci skip] 2022-07-09 19:03:51 +00:00
Jrnl Bot
50b320063a Increment version to v3.0 2022-07-09 19:02:32 +00:00
Jrnl Bot
bfe58a18e5 Update changelog [ci skip] 2022-07-09 18:56:09 +00:00
Jonathan Wren
db6f80d721
Limit pytest-bdd to <6.0 to temporarily avoid breaking changes (#1536)
This will unblock other tests for now
2022-07-09 11:54:15 -07:00
Jrnl Bot
0279637fe4 Update changelog [ci skip] 2022-06-25 21:47:37 +00:00
Jrnl Bot
97cb7a678e Increment version to v3.0-beta2 2022-06-25 21:46:02 +00:00
Jonathan Wren
0f2962a95f
Add and run isort on Python files (#1520)
* add and run isort

* udpate more import statements

* fix typo
2022-06-25 14:43:32 -07:00
Jonathan Wren
20254f7434
Run tests in parallel (#1519)
* 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
2022-06-25 13:12:52 -07:00
Jrnl Bot
3fd109b6cd Update changelog [ci skip] 2022-06-25 19:48:47 +00:00
Kevin
8b955ef002
Add bdd tests for jrnl installation (#1513)
* Added bdd tests for jrnl installation
2022-06-25 12:47:05 -07:00
Jonathan Wren
23bc0f2c8f
Reduce difference between local and CI environments (#1518)
* 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
2022-06-25 12:45:39 -07:00
Jrnl Bot
856f361271 Update changelog [ci skip] 2022-06-25 19:01:37 +00:00
dependabot[bot]
e531d575be
Bump poethepoet from 0.13.1 to 0.14.0 (#1514)
Bumps [poethepoet](https://github.com/nat-n/poethepoet) from 0.13.1 to 0.14.0.
- [Release notes](https://github.com/nat-n/poethepoet/releases)
- [Commits](https://github.com/nat-n/poethepoet/compare/v0.13.1...v0.14.0)

---
updated-dependencies:
- dependency-name: poethepoet
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-25 11:59:41 -07:00
dependabot[bot]
c0ebf12cc8
Bump cryptography from 37.0.2 to 37.0.3 (#1516)
Bumps [cryptography](https://github.com/pyca/cryptography) from 37.0.2 to 37.0.3.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/37.0.2...37.0.3)

---
updated-dependencies:
- dependency-name: cryptography
  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>
2022-06-25 11:59:09 -07:00
Kevin
ed4f8eacea
Display message when no edits take place (#1510) 2022-06-25 11:58:31 -07:00
Jonathan Wren
28051046d5
Update maintainer email (#1515) 2022-06-25 11:51:19 -07:00
Jrnl Bot
5fb5e1140a Update changelog [ci skip] 2022-06-18 18:56:04 +00:00
Jonathan Wren
7dccc469b5
Implement Tox for testing (#1504)
* 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
2022-06-18 11:54:28 -07:00
Jonathan Wren
bd590213a1
Stop hardcoding bot info in some pipelines (#1506) 2022-06-18 11:53:20 -07:00
Jonathan Wren
fe2b976849
update cache for accessibility tests (to match other tests) (#1505) 2022-06-18 11:51:51 -07:00
Jrnl Bot
2981de95b0 Update changelog [ci skip] 2022-06-18 18:39:06 +00:00
Jonathan Wren
51ab747019
Replace make with python alternative (poe) (#1503)
* 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
2022-06-18 11:36:56 -07:00
Jrnl Bot
c1c70e643a Update changelog [ci skip] 2022-06-18 18:32:43 +00:00
Jonathan Wren
f5e052937c
Update copyright year (#1502)
Update copyright year in comment headers and --version output
2022-06-18 11:30:56 -07:00
Jrnl Bot
9639c5386f Update changelog [ci skip] 2022-06-11 21:11:01 +00:00
Jrnl Bot
7e7d374263 Increment version to v3.0-beta 2022-06-11 21:09:10 +00:00
Jrnl Bot
37ef1d9bc6 Update changelog [ci skip] 2022-06-11 21:08:07 +00:00
Micah Jerome Ellison
86bc9bfd80
Add Python 3.11 to PR tests (#1500)
* Add Python 3.11 to PR tests
* Add testing_prs to trigger for testing PRs
2022-06-11 14:06:02 -07:00
Jonathan Wren
f53110c69b
Rework how all output and messaging works in jrnl (#1475)
* 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>
2022-06-11 13:32:11 -07:00
Jrnl Bot
4d683a13c0 Update changelog [ci skip] 2022-06-11 18:41:17 +00:00
dependabot[bot]
e2978029a5
Bump pyxdg from 0.27 to 0.28 (#1497)
Bumps [pyxdg](https://github.com/takluyver/pyxdg) from 0.27 to 0.28.
- [Release notes](https://github.com/takluyver/pyxdg/releases)
- [Changelog](https://github.com/takluyver/pyxdg/blob/master/ChangeLog)
- [Commits](https://github.com/takluyver/pyxdg/compare/rel-0.27...rel-0.28)

---
updated-dependencies:
- dependency-name: pyxdg
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-11 11:39:09 -07:00
Jrnl Bot
024de4d8b3 Update changelog [ci skip] 2022-06-11 18:37:54 +00:00
dependabot[bot]
b66e28faa0
Bump keyring from 23.5.1 to 23.6.0 (#1499)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.5.1 to 23.6.0.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.5.1...v23.6.0)

---
updated-dependencies:
- dependency-name: keyring
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-11 11:36:20 -07:00
Jrnl Bot
c07cdbed3c Update changelog [ci skip] 2022-06-04 22:15:16 +00:00
Kevin
c043f5058f
Fixed error related to display_format in config file for some values (#1495)
* 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>
2022-06-04 15:13:30 -07:00
Jonathan van der Steege
e758986985
Create folder if config ends with (back)slash (#1492)
* 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
2022-06-04 13:20:51 -07:00
Jrnl Bot
1c35c6951d Update changelog [ci skip] 2022-06-04 20:10:38 +00:00
Kevin
36121007b1
-not search parameter doesn't open editor (#1490) 2022-06-04 13:09:07 -07:00
Jrnl Bot
19d579fc5c Update changelog [ci skip] 2022-05-28 18:54:06 +00:00
Jonathan van der Steege
bb0a6f5854
Fixed debug TypeError (#1484) 2022-05-28 11:52:10 -07:00
Jrnl Bot
7f91d512b8 Update changelog [ci skip] 2022-05-28 18:45:24 +00:00
dependabot[bot]
de6a90a5ee
Bump keyring from 23.5.0 to 23.5.1 (#1487)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.5.0 to 23.5.1.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.5.0...v23.5.1)

---
updated-dependencies:
- dependency-name: keyring
  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>
2022-05-28 11:43:43 -07:00
Jrnl Bot
fd8d64098f Update changelog [ci skip] 2022-05-21 21:14:56 +00:00
Micah Jerome Ellison
11209b4b42
Document --change-time in web-based docs' command line reference (#1471)
* Document change-time in command line reference
* Keep mkdocs version under 1.3 both locally and for readthedocs
2022-05-21 14:13:24 -07:00
Jonathan van der Steege
663f151974
Prompt for password change when using 'jrnl --encrypt' on already encrypted journal (#1477)
* Create new password if journal already encrypted.
* Add test for encrypting already encrypted journal.
2022-05-21 14:11:55 -07:00
Jrnl Bot
7771afc1a7 Update changelog [ci skip] 2022-05-21 21:07:40 +00:00
Kevin
ea6df4705c
Always expand all paths (journals, templates, etc) (#1468)
* 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>
2022-05-21 14:06:07 -07:00
Jrnl Bot
1ce7ce8bfc Update changelog [ci skip] 2022-05-21 21:05:09 +00:00
Jonathan van der Steege
86c8466ae4
Show name of journal when creating a password/encrypting (#1478)
* Show name of journal when creating password
2022-05-21 14:03:18 -07:00
Jrnl Bot
55b72a49b6 Update changelog [ci skip] 2022-05-21 19:05:14 +00:00
Richard Schneider
33c9dce80d
Implement --change-time flag (#1452)
* 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
2022-05-21 12:03:27 -07:00
Jrnl Bot
e6ed64ac7a Update changelog [ci skip] 2022-05-07 19:21:16 +00:00
Kevin
8458cdb06f
Fixed -not option with no arguments bug (#1466) 2022-05-07 12:19:37 -07:00
Jrnl Bot
4dacd86bc3 Update changelog [ci skip] 2022-05-07 19:15:14 +00:00
Jonathan van der Steege
792f188ecc
Give a proper message when trying to use an empty config file (#1461)
* 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>
2022-05-07 12:13:36 -07:00
Jrnl Bot
71c1d38d50 Update changelog [ci skip] 2022-05-07 18:12:57 +00:00
Kevin
74200f8dc4
Yaml export errors now don't show stack trace (#1449)
* 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>
2022-05-07 11:11:00 -07:00
Jrnl Bot
048c9d40e7 Update changelog [ci skip] 2022-05-07 17:51:26 +00:00
dependabot[bot]
41e4b81192
Bump cryptography from 37.0.1 to 37.0.2 (#1467)
Bumps [cryptography](https://github.com/pyca/cryptography) from 37.0.1 to 37.0.2.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/37.0.1...37.0.2)

---
updated-dependencies:
- dependency-name: cryptography
  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>
2022-05-07 10:49:23 -07:00
Jrnl Bot
6a12853b65 Update changelog [ci skip] 2022-04-30 19:41:10 +00:00
Kevin
d6d6db0aa3
Display "No entry to save, because no text was received" after empty entry on cmdline (#1459)
* Display "Entry not saved" after empty entry on cmdline
* update error message
2022-04-30 12:39:36 -07:00
Jrnl Bot
d21398ee60 Update changelog [ci skip] 2022-04-30 18:30:34 +00:00
dependabot[bot]
2b3cf88097
Bump pytest from 7.1.1 to 7.1.2 (#1458)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.1.1 to 7.1.2.
- [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/7.1.1...7.1.2)

---
updated-dependencies:
- dependency-name: pytest
  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>
2022-04-30 11:29:03 -07:00
dependabot[bot]
e2f0f8cc9b
Bump cryptography from 36.0.2 to 37.0.1 (#1462)
Bumps [cryptography](https://github.com/pyca/cryptography) from 36.0.2 to 37.0.1.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/36.0.2...37.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  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>
2022-04-30 11:28:34 -07:00
Jrnl Bot
97f326a59c Update changelog [ci skip] 2022-04-16 18:31:52 +00:00
dependabot[bot]
4d72f0be62
Bump pyproject-flake8 from 0.0.1a3 to 0.0.1a4 (#1447)
Bumps [pyproject-flake8](https://github.com/csachs/pyproject-flake8) from 0.0.1a3 to 0.0.1a4.
- [Release notes](https://github.com/csachs/pyproject-flake8/releases)
- [Commits](https://github.com/csachs/pyproject-flake8/compare/v0.0.1a3...v0.0.1a4)

---
updated-dependencies:
- dependency-name: pyproject-flake8
  dependency-type: direct:development
  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>
2022-04-16 11:29:53 -07:00
Jrnl Bot
3d036256b2 Update changelog [ci skip] 2022-04-09 21:00:41 +00:00
dependabot[bot]
96d45847f9
Bump pyproject-flake8 from 0.0.1a2 to 0.0.1a3 (#1440)
Bumps [pyproject-flake8](https://github.com/csachs/pyproject-flake8) from 0.0.1a2 to 0.0.1a3.
- [Release notes](https://github.com/csachs/pyproject-flake8/releases)
- [Commits](https://github.com/csachs/pyproject-flake8/compare/v0.0.1a2...v0.0.1a3)

---
updated-dependencies:
- dependency-name: pyproject-flake8
  dependency-type: direct:development
  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>
2022-04-09 13:58:58 -07:00
dependabot[bot]
026cafad3f
Bump mkdocs from 1.2.3 to 1.3.0 (#1441)
Bumps [mkdocs](https://github.com/mkdocs/mkdocs) from 1.2.3 to 1.3.0.
- [Release notes](https://github.com/mkdocs/mkdocs/releases)
- [Commits](https://github.com/mkdocs/mkdocs/compare/1.2.3...1.3.0)

---
updated-dependencies:
- dependency-name: mkdocs
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-09 13:58:43 -07:00
dependabot[bot]
2c626844ef
Bump black from 22.1.0 to 22.3.0 (#1442)
Bumps [black](https://github.com/psf/black) from 22.1.0 to 22.3.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/compare/22.1.0...22.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-09 13:58:21 -07:00
Jrnl Bot
650aeb387b Update changelog [ci skip] 2022-03-26 18:50:20 +00:00
Micah Jerome Ellison
23839305d8
Pin jinja2 in docs requirements to keep readthedocs builds from failing (#1439)
* 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")
2022-03-26 11:48:41 -07:00
Jrnl Bot
17e09df050 Update changelog [ci skip] 2022-03-26 18:36:47 +00:00
Micah Jerome Ellison
d405e92292
Remove sample format and its asteval dependency (#1436) 2022-03-26 11:35:14 -07:00
Jrnl Bot
a969f9b3fb Update changelog [ci skip] 2022-03-26 18:25:14 +00:00
dependabot[bot]
a40d4536f6
Bump pytest from 7.0.1 to 7.1.1 (#1430)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.0.1 to 7.1.1.
- [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/7.0.1...7.1.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-26 11:23:28 -07:00
dependabot[bot]
edc2e524f7
Bump pytz from 2021.3 to 2022.1 (#1438)
Bumps [pytz](https://github.com/stub42/pytz) from 2021.3 to 2022.1.
- [Release notes](https://github.com/stub42/pytz/releases)
- [Commits](https://github.com/stub42/pytz/compare/release_2021.3...release_2022.1)

---
updated-dependencies:
- dependency-name: pytz
  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>
2022-03-26 11:21:43 -07:00
Jonathan Wren
bc42f74b2b
Reformat additional messages and finish centralizing exception handling (#1424)
* 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>
2022-03-19 12:30:23 -07:00
Jrnl Bot
a1117918dd Update changelog [ci skip] 2022-03-19 19:09:40 +00:00
dependabot[bot]
7cb8345e85
Bump cryptography from 36.0.1 to 36.0.2 (#1427)
Bumps [cryptography](https://github.com/pyca/cryptography) from 36.0.1 to 36.0.2.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/36.0.1...36.0.2)

---
updated-dependencies:
- dependency-name: cryptography
  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>
2022-03-19 12:07:56 -07:00
Jrnl Bot
7a42800168 Update changelog [ci skip] 2022-03-12 21:26:01 +00:00
Micah Jerome Ellison
d3de5b778b
Replace PyYAML with ruamel.yaml (#1416)
* 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
2022-03-12 13:24:31 -08:00
Jonathan Wren
e46b5a171f
Fix tests for daylight savings (#1423)
* 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
2022-03-12 13:14:26 -08:00
Jonathan Wren
5273f8769d
Reformat messages and add new centralized exception handling (#1417)
* 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>
2022-03-12 12:43:26 -08:00
Jrnl Bot
d6ff04cf17 Update changelog [ci skip] 2022-02-26 20:05:39 +00:00
dependabot[bot]
b4e7246526
Bump yq from 2.13.0 to 2.14.0 (#1418)
Bumps [yq](https://github.com/kislyuk/yq) from 2.13.0 to 2.14.0.
- [Release notes](https://github.com/kislyuk/yq/releases)
- [Changelog](https://github.com/kislyuk/yq/blob/develop/Changes.rst)
- [Commits](https://github.com/kislyuk/yq/compare/v2.13.0...v2.14.0)

---
updated-dependencies:
- dependency-name: yq
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-26 12:03:57 -08:00
Nelson
20d6eda1ad
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>
2022-02-17 15:38:11 -08:00
Jrnl Bot
2ec4567f69 Update changelog [ci skip] 2022-02-12 22:09:44 +00:00
Micah Jerome Ellison
117e0de5bc
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
2022-02-12 14:07:56 -08:00
Jrnl Bot
f9a0695865 Update changelog [ci skip] 2022-02-12 20:53:58 +00:00
dependabot[bot]
c2f1d19eaf
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>
2022-02-12 12:52:14 -08:00
Jrnl Bot
9bceb39e26 Update changelog [ci skip] 2022-02-12 12:50:42 -08:00
Jrnl Bot
72fea986d0 Increment version to v2.8.4 2022-02-12 20:41:34 +00:00
Jrnl Bot
fa874ace12 Update changelog [ci skip] 2022-02-05 21:09:51 +00:00
Jrnl Bot
cfeb9e01b7 Increment version to v2.8.4-beta2 2022-02-05 21:08:19 +00:00
Jrnl Bot
4b6a8efe0f Update changelog [ci skip] 2022-02-05 21:07:34 +00:00
Micah Jerome Ellison
f37062c9b6
Add hash as a default tag symbol (#1398) 2022-02-05 13:06:03 -08:00
Micah Jerome Ellison
cd865e048e
Add --co alias for --config-override (#1397) 2022-02-05 13:04:23 -08:00
Jrnl Bot
f890e2fcd3 Update changelog [ci skip] 2022-02-05 21:01:00 +00:00
Micah Jerome Ellison
972af21bca
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
2022-02-05 12:59:20 -08:00
Jrnl Bot
967ec86d9d Update changelog [ci skip] 2022-02-05 20:05:36 +00:00
dependabot[bot]
a8f0b18219
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>
2022-02-05 12:04:06 -08:00
Jrnl Bot
0773d6b1d3 Update changelog [ci skip] 2022-02-05 19:45:38 +00:00
dependabot[bot]
b1e228ea40
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>
2022-02-05 11:44:06 -08:00
Jrnl Bot
5463476a00 Update changelog [ci skip] 2022-01-22 18:17:22 +00:00
dependabot[bot]
aa2c77abfc
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>
2022-01-22 10:15:36 -08:00
Jonathan Wren
1fbb788528
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
2022-01-15 14:45:00 -08:00
Jrnl Bot
49930e16f7 Update changelog [ci skip] 2022-01-15 20:14:21 +00:00
dependabot[bot]
5555557cec
Bump cryptography from 36.0.0 to 36.0.1 (#1389)
Bumps [cryptography](https://github.com/pyca/cryptography) from 36.0.0 to 36.0.1.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/36.0.0...36.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  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>
2022-01-15 12:12:39 -08:00
Jrnl Bot
d0921fb7b6 Update changelog [ci skip] 2022-01-08 22:52:46 +00:00
Jonathan Wren
e7f24527c3
Fix styling on documentation sidebar (#1395)
* fix sidebar stling in docs theme

* don't display heading levels higher than 3 in sidebar

* update sitemap step for easier debugging

* add matrix so github doesn't get confused
2022-01-08 14:51:02 -08:00
Jrnl Bot
c4c60efab2 Update changelog [ci skip] 2022-01-08 20:44:40 +00:00
dependabot[bot]
bf757bdc90
Bump keyring from 23.4.0 to 23.5.0 (#1392)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.4.0 to 23.5.0.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.4.0...v23.5.0)

---
updated-dependencies:
- dependency-name: keyring
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-08 12:43:09 -08:00
Jrnl Bot
256aab9877 Update changelog [ci skip] 2022-01-08 20:38:48 +00:00
Micah Jerome Ellison
3b0c7992d2
Add weekly Saturday morning build and prevent Python 3.11 from running on PRs (#1387)
* 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>
2022-01-08 12:36:58 -08:00
Jrnl Bot
bb0d96a005 Update changelog [ci skip] 2021-12-11 20:41:46 +00:00
Jrnl Bot
2244f1ff77 Increment version to v2.8.4-beta1 2021-12-11 20:40:10 +00:00
Jrnl Bot
28b6126853 Update changelog [ci skip] 2021-12-11 20:37:19 +00:00
Jonathan Wren
2ab485de8c
Improve handling of mocking logic in pytest (#1382)
* 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>
2021-12-11 12:35:32 -08:00
dependabot[bot]
3518e37087
Bump black from 21.11b1 to 21.12b0 (#1384)
Bumps [black](https://github.com/psf/black) from 21.11b1 to 21.12b0.
- [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)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-11 12:02:30 -08:00
dependabot[bot]
e9e75ea36b
Bump keyring from 23.3.0 to 23.4.0 (#1383)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.3.0 to 23.4.0.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.3.0...v23.4.0)

---
updated-dependencies:
- dependency-name: keyring
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-11 12:02:20 -08:00
Jrnl Bot
4552936e89 Update changelog [ci skip] 2021-12-11 19:57:33 +00:00
dependabot[bot]
bf0a4e0d1a
Bump yq from 2.12.2 to 2.13.0 (#1385)
Bumps [yq](https://github.com/kislyuk/yq) from 2.12.2 to 2.13.0.
- [Release notes](https://github.com/kislyuk/yq/releases)
- [Changelog](https://github.com/kislyuk/yq/blob/develop/Changes.rst)
- [Commits](https://github.com/kislyuk/yq/compare/v2.12.2...v2.13.0)

---
updated-dependencies:
- dependency-name: yq
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-11 11:55:55 -08:00
Jrnl Bot
ba8a59b26f Update changelog [ci skip] 2021-11-27 19:52:07 +00:00
dependabot[bot]
a3aeb38611
Bump cryptography from 35.0.0 to 36.0.0 (#1379)
Bumps [cryptography](https://github.com/pyca/cryptography) from 35.0.0 to 36.0.0.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/35.0.0...36.0.0)

---
updated-dependencies:
- dependency-name: cryptography
  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>
2021-11-27 11:49:27 -08:00
dependabot[bot]
9e99a2ea96
Bump keyring from 23.2.1 to 23.3.0 (#1381)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.2.1 to 23.3.0.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.2.1...v23.3.0)

---
updated-dependencies:
- dependency-name: keyring
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-27 11:47:51 -08:00
Jrnl Bot
882721f859 Update changelog [ci skip] 2021-11-20 19:58:26 +00:00
dependabot[bot]
03940ad598
Bump black from 21.10b0 to 21.11b1 (#1375)
Bumps [black](https://github.com/psf/black) from 21.10b0 to 21.11b1.
- [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)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-20 11:56:41 -08:00
Jrnl Bot
a1f6d78e04 Update changelog [ci skip] 2021-11-20 19:49:53 +00:00
Piero Lescano
ba3fd2202f
Add added option to _print_edited_summary (#1366)
* 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>
2021-11-20 11:47:56 -08:00
Jrnl Bot
ffc8bdd5f1 Update changelog [ci skip] 2021-11-13 22:54:50 +00:00
Micah Jerome Ellison
5e45f305ac
Use full Python version for GitHub Actions cache key (#1373) 2021-11-13 14:52:42 -08:00
dependabot[bot]
55dd9484c9
Bump mkdocs from 1.1 to 1.2.3 in /docs_theme (#1360)
Bumps [mkdocs](https://github.com/mkdocs/mkdocs) from 1.1 to 1.2.3.
- [Release notes](https://github.com/mkdocs/mkdocs/releases)
- [Commits](https://github.com/mkdocs/mkdocs/compare/1.1...1.2.3)

---
updated-dependencies:
- dependency-name: mkdocs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-13 11:48:27 -08:00
Jrnl Bot
bbfa32a115 Update changelog [ci skip] 2021-11-06 21:27:23 +00:00
Jrnl Bot
7a70bbc51e Increment version to v2.8.4-beta 2021-11-06 21:25:54 +00:00
Jrnl Bot
93d59edb67 Update changelog [ci skip] 2021-11-06 21:19:41 +00:00
Micah Jerome Ellison
06ee6db7e7
Use Python 3.10 stable in CI (#1362)
* 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
2021-11-06 14:18:00 -07:00
Jrnl Bot
a354b13139 Update changelog [ci skip] 2021-11-06 21:14:16 +00:00
samuelgregorovic
ae009099ed
Add --config-file argument to use alternate config file at runtime (#1290)
* 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>
2021-11-06 14:12:34 -07:00
Jrnl Bot
5057c290c1 Update changelog [ci skip] 2021-11-06 20:39:19 +00:00
dependabot[bot]
e242aa4ced
Bump pytest-bdd from 4.1.0 to 5.0.0 (#1368)
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 4.1.0 to 5.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases)
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/4.1.0...5.0.0)

---
updated-dependencies:
- dependency-name: pytest-bdd
  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>
2021-11-06 13:37:54 -07:00
Jrnl Bot
e082156779 Update changelog [ci skip] 2021-11-06 20:32:07 +00:00
Ben Beasley
99c19b2a64
Support pytest-bdd 5.x (#1365)
https://github.com/pytest-dev/pytest-bdd/blob/5.0.0/README.rst#migration-of-your-tests-from-versions-4xx
2021-11-06 13:30:25 -07:00
Jrnl Bot
f608e176c1 Update changelog [ci skip] 2021-11-06 20:26:39 +00:00
dependabot[bot]
8cabf0f87a
Bump black from 21.9b0 to 21.10b0 (#1370)
Bumps [black](https://github.com/psf/black) from 21.9b0 to 21.10b0.
- [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)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-06 13:24:50 -07:00
Jrnl Bot
b4ccf44d3a Update changelog [ci skip] 2021-10-23 19:19:39 +00:00
Fabian Affolter
c68c13ab6e
Switch to poetry-core (#1359) 2021-10-23 12:17:32 -07:00
Jrnl Bot
54c9a058df Update changelog [ci skip] 2021-10-16 22:23:23 +00:00
Micah Jerome Ellison
b1ba88c138
Migrate contributing.md to docs site (#1266)
* 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>
2021-10-16 15:21:49 -07:00
dependabot[bot]
533d770753 Bump pyyaml from 5.4.1 to 6.0 (#1356)
Bumps [pyyaml](https://github.com/yaml/pyyaml) from 5.4.1 to 6.0.
- [Release notes](https://github.com/yaml/pyyaml/releases)
- [Changelog](https://github.com/yaml/pyyaml/blob/master/CHANGES)
- [Commits](https://github.com/yaml/pyyaml/compare/5.4.1...6.0)

---
updated-dependencies:
- dependency-name: pyyaml
  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>
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-10-16 15:06:11 -07:00
Jrnl Bot
8cc891a77f Update changelog [ci skip] 2021-10-16 21:39:13 +00:00
Gianluca Mondini
156ddee97c
Fix recipe 'Launch a terminal for rapid logging' (#1351) 2021-10-16 14:37:43 -07:00
Jrnl Bot
b93b7cdfd6 Update changelog [ci skip] 2021-10-16 20:53:57 +00:00
Fidel H Viegas
9f5c2f6829
Add recipe for visualizing Markdown in the CLI (#1354)
* 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>
2021-10-16 13:52:13 -07:00
Jrnl Bot
62dc037d80 Update changelog [ci skip] 2021-10-16 20:22:04 +00:00
dependabot[bot]
ae1ad39806
Bump mkdocs from 1.2.2 to 1.2.3 (#1355)
Bumps [mkdocs](https://github.com/mkdocs/mkdocs) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/mkdocs/mkdocs/releases)
- [Commits](https://github.com/mkdocs/mkdocs/compare/1.2.2...1.2.3)

---
updated-dependencies:
- dependency-name: mkdocs
  dependency-type: direct:development
  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>
2021-10-16 13:20:14 -07:00
Jrnl Bot
d347dac19e Update changelog [ci skip] 2021-10-09 19:11:41 +00:00
Jonathan Wren
44edb9bdee
Add more steps to pytest, fully remove behave (#1347)
* 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>
2021-10-09 12:10:08 -07:00
Jrnl Bot
a98f3f78af Update changelog [ci skip] 2021-10-09 18:45:22 +00:00
dependabot[bot]
1196b05ff6
Bump pytz from 2021.1 to 2021.3 (#1348)
Bumps [pytz](https://github.com/stub42/pytz) from 2021.1 to 2021.3.
- [Release notes](https://github.com/stub42/pytz/releases)
- [Commits](https://github.com/stub42/pytz/compare/release_2021.1...release_2021.3)

---
updated-dependencies:
- dependency-name: pytz
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-09 11:43:43 -07:00
Jonathan Wren
7d8823da6d
Move remaining tests from behave to pytest (#1346)
* 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
2021-10-02 13:31:21 -07:00
Jrnl Bot
593245f3fd Update changelog [ci skip] 2021-10-02 19:24:53 +00:00
dependabot[bot]
60c9ed124d
Bump cryptography from 3.4.8 to 35.0.0 (#1345)
Bumps [cryptography](https://github.com/pyca/cryptography) from 3.4.8 to 35.0.0.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.4.8...35.0.0)

---
updated-dependencies:
- dependency-name: cryptography
  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>
2021-10-02 12:23:17 -07:00
Micah Jerome Ellison
4c0fb344d1
Add CACHE_STRING secret to bust GitHub Actions python cache (#1344)
* Add CACHE_STRING secret to allow maintainers to bust cache without a commit

* Quick change

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-09-25 11:11:28 -07:00
Jrnl Bot
9f16cc42f5 Update changelog [ci skip] 2021-09-18 23:28:00 +00:00
Micah Jerome Ellison
614be34081
Document journal types (#1331)
* 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
2021-09-18 16:26:28 -07:00
Jrnl Bot
b932cfc9ad Update changelog [ci skip] 2021-09-18 19:53:58 +00:00
dependabot[bot]
73806c2d30
Bump keyring from 23.1.0 to 23.2.1 (#1342)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.1.0 to 23.2.1.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.1.0...v23.2.1)

---
updated-dependencies:
- dependency-name: keyring
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-18 12:52:14 -07:00
Jrnl Bot
79e3c94669 Update changelog [ci skip] 2021-09-18 19:51:58 +00:00
dependabot[bot]
f67e8947a5
Bump black from 21.8b0 to 21.9b0 (#1343)
Bumps [black](https://github.com/psf/black) from 21.8b0 to 21.9b0.
- [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)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-18 12:50:26 -07:00
Jrnl Bot
d968730adf Update changelog [ci skip] 2021-09-18 19:33:41 +00:00
Micah Jerome Ellison
fabdac887e
Fix splash image for PyPi (I hope) and add changelog badge (#1339) 2021-09-18 12:31:45 -07:00
Jrnl Bot
6f6ee7b54f Update changelog [ci skip] 2021-09-06 19:57:05 +00:00
dependabot[bot]
087b038d77
Bump black from 21.7b0 to 21.8b0 (#1333)
Bumps [black](https://github.com/psf/black) from 21.7b0 to 21.8b0.
- [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)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-06 12:55:29 -07:00
Jrnl Bot
73145888e6 Update changelog [ci skip] 2021-09-06 19:55:02 +00:00
dependabot[bot]
3615abd4e2
Bump pytest from 6.2.4 to 6.2.5 (#1334)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.4 to 6.2.5.
- [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.4...6.2.5)

---
updated-dependencies:
- dependency-name: pytest
  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>
2021-09-06 12:53:18 -07:00
Jrnl Bot
72f2d14427 Update changelog [ci skip] 2021-09-06 19:44:30 +00:00
Jrnl Bot
8ccaf4ac1d Increment version to v2.8.3 2021-09-06 19:43:07 +00:00
Jrnl Bot
778c1de6eb Update changelog [ci skip] 2021-08-28 23:00:37 +00:00
Jrnl Bot
a32aefe541 Increment version to v2.8.3-beta 2021-08-28 22:58:59 +00:00
Jrnl Bot
3c561af93d Update changelog [ci skip] 2021-08-28 20:22:11 +00:00
dependabot[bot]
7eaeef821e
Bump cryptography from 3.4.7 to 3.4.8 (#1329)
Bumps [cryptography](https://github.com/pyca/cryptography) from 3.4.7 to 3.4.8.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.4.7...3.4.8)

---
updated-dependencies:
- dependency-name: cryptography
  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>
2021-08-28 13:20:25 -07:00
Jrnl Bot
7030185e4f Update changelog [ci skip] 2021-08-28 20:20:16 +00:00
Micah Jerome Ellison
5abf974682
Fix deletion of entries on folder journal through --delete flag (#1328)
* 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
2021-08-28 13:18:34 -07:00
Micah Jerome Ellison
fa146b1434
Warn when DayOne/directory journals have encrypt: true in config (#1325)
* 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
2021-08-21 14:47:49 -07:00
Jrnl Bot
c52e878c01 Update changelog [ci skip] 2021-08-21 21:44:38 +00:00
Micah Jerome Ellison
050c17ee06
Allow emoji in config file in Windows by always opening it as unicode (#1313)
* Open config file as utf-8 always
* Add test for journal with emoji name
2021-08-21 14:43:11 -07:00
Micah Jerome Ellison
7109374d42
Fix failure to import into directory journal (#1314)
* Re-enable failing directory journal import tests
* Appropriately track journal name and modified entries in FolderJournal when importing
* Run make format
2021-08-21 14:42:31 -07:00
Jonathan Wren
08350b884b
take out redundant lines from PR template (#1327) 2021-08-21 14:00:31 -07:00
Jrnl Bot
bacbf8109b Update changelog [ci skip] 2021-08-21 20:48:08 +00:00
Micah Jerome Ellison
3e5a55b1e9
Display error when trying to encrypt folder/DayOne journal types (#1315)
* 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
2021-08-21 13:46:29 -07:00
Jrnl Bot
9de723d014 Update changelog [ci skip] 2021-08-21 19:10:25 +00:00
Micah Jerome Ellison
a0a3ef669e
Set bash as default shell (#1324) 2021-08-21 12:08:44 -07:00
Jrnl Bot
1c63d94736 Update changelog [ci skip] 2021-08-17 03:24:18 +00:00
dependabot[bot]
32b5a2b5d0
Bump keyring from 23.0.1 to 23.1.0 (#1318)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.0.1 to 23.1.0.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.0.1...v23.1.0)

---
updated-dependencies:
- dependency-name: keyring
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-16 20:22:39 -07:00
Jonathan Wren
3b93e92960
take out arg for old plugin from makefile (#1322) 2021-08-16 20:13:44 -07:00
Jrnl Bot
5ec7dec9f0 Update changelog [ci skip] 2021-08-17 02:47:47 +00:00
Jonathan Wren
8a64b77e63
Update build to poetry alpha 2 for python 3.10 (#1320)
* udpate build to poetry alpha 2 for python 3.10

* update testing workflow to run when workflow itself is changed
2021-08-16 19:46:01 -07:00
Jrnl Bot
b23c831da5 Update changelog [ci skip] 2021-07-31 19:11:33 +00:00
Jrnl Bot
eaaa7bb0e1 Increment version to v2.8.2 2021-07-31 19:10:05 +00:00
Jrnl Bot
c49853d724 Update changelog [ci skip] 2021-07-31 18:47:00 +00:00
dependabot[bot]
642155292a
Bump mkdocs from 1.2.1 to 1.2.2 (#1307)
Bumps [mkdocs](https://github.com/mkdocs/mkdocs) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/mkdocs/mkdocs/releases)
- [Commits](https://github.com/mkdocs/mkdocs/compare/1.2.1...1.2.2)

---
updated-dependencies:
- dependency-name: mkdocs
  dependency-type: direct:development
  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>
2021-07-31 11:45:19 -07:00
Micah Jerome Ellison
c9c6e7efc1
Fix typo in --help (#1309) 2021-07-31 11:43:19 -07:00
Jrnl Bot
1ba1b756c9 Update changelog [ci skip] 2021-07-17 22:17:56 +00:00
Jrnl Bot
f158d7f266 Increment version to v2.8.2-beta 2021-07-17 22:16:08 +00:00
Jrnl Bot
cef3a98b4e Update changelog [ci skip] 2021-07-17 20:23:48 +00:00
Micah Jerome Ellison
31f782e333
Add documentation about saved passwords in Windows (#1301)
* Add note about saved passwords
* Add missing yq dep back in to allow xq to run in mkdocs CI pipeline
2021-07-17 13:22:01 -07:00
Jrnl Bot
3e95a46bd2 Update changelog [ci skip] 2021-07-17 19:15:00 +00:00
dependabot[bot]
52c0a0ebf3
Bump python-dateutil from 2.8.1 to 2.8.2 (#1302)
Bumps [python-dateutil](https://github.com/dateutil/dateutil) from 2.8.1 to 2.8.2.
- [Release notes](https://github.com/dateutil/dateutil/releases)
- [Changelog](https://github.com/dateutil/dateutil/blob/master/NEWS)
- [Commits](https://github.com/dateutil/dateutil/compare/2.8.1...2.8.2)

---
updated-dependencies:
- dependency-name: python-dateutil
  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>
2021-07-17 12:13:19 -07:00
Jrnl Bot
b896c85bf0 Update changelog [ci skip] 2021-07-17 19:03:29 +00:00
Micah Jerome Ellison
7b72b24ee2
Add first draft of security.md (#1299) 2021-07-17 12:01:59 -07:00
Jonathan Wren
e771c9da81
Update lock file from poetry stable version (#1298) 2021-07-10 13:53:00 -07:00
Jrnl Bot
9bd395007f Update changelog [ci skip] 2021-07-10 19:14:56 +00:00
Micah Jerome Ellison
2723e1cfb5
Add Python 3.10 support (#1271)
* 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>
2021-07-10 12:13:15 -07:00
Jrnl Bot
56df419bea Update changelog [ci skip] 2021-07-03 22:52:14 +00:00
Micah Jerome Ellison
9e3153453e
Change all instances of FullLoader to SafeLoader (#1285) 2021-07-03 15:50:36 -07:00
Jonathan Wren
26484130c3 remove old comment 2021-07-03 15:49:18 -07:00
Jonathan Wren
495956d907 remove init file that is no longer neded 2021-07-03 15:49:18 -07:00
Jonathan Wren
d95dab9f0c add actual lib directory even though it's in gitignore for some reason 2021-07-03 15:49:18 -07:00
Jonathan Wren
f99411f2f9 move some files around because pytest is being weird 2021-07-03 15:49:18 -07:00
Jonathan Wren
cdad0d6289 Replace pyflakes with flake8 for linting 2021-07-03 15:49:18 -07:00
Jonathan Wren
c5a7d7027c Move pytest-bdd code into separate files
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.
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
54e5e96ad2 Force GitHub Actions to preserve line endings
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
fd349fb0fc Implement ExitStack to handle mocks in pytest-bdd
- Fix failing DayOne test
- Make format and clean up extraneous comment

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
0c8efd5331 Cleanup last few tests
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
5572833652 Rewrite config checking steps in pytest-bdd
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
b7b7bad2fb Clarify and cleanup tests
- Run formatter
- Take out old tags
- Use new steps on tests

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
44b1762b7d Implement stream redirection in pytest-bdd
- Take out old steps from format and input tests

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
512fb63e1f Implement test to check editor temporary filename
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
5d4d68fe32 Implement directory changing and relative directory test
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
7647755e96 Implement journal existence check
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
ef25c50e16 Implement step for directory journals
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
4aabb73847 Implement datetime handling in pytest-bdd
- This was awful and convoluted

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
cda07bf8d9 Make steps use new config file
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
e19fab0615 Add new config file (for use in pytest-bdd)
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
e0980cf396 Update tests to use more scenario outlines
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
3d29b6b6a1 Fix star and tag feature language and add output should be empty test
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
8faa3ae32d Update tests to use new steps
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
d15e683955 Update search features to use new steps
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
3ddfb4d594 Implement editor-related steps in pytest-bdd
- 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>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
ce64d7973b Implement @skip_win and @skip_editor
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
36dc01bf30 Fixing custom template test and skipping some broken tests
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
148d3fdb18 Update test w/ new steps
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
a6a4417eff Fix annoying poetry-generated Windows line endings
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
849ed16d67 Install pytest-icdiff and run poetry lock
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
11e0e84dcf Fix test failing from lack of whitespace
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
430182a0a5 Implement JSON tests and remove "node" nomenclature from tests
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
48c9d9fa16 Implement tag tests in JSON
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
3cc3e387c5 Combine JSON and XML parsing tests
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
ef6ed93ecd Add JSON parsing test and combine it with XML parsing test
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
3b044e3044 Ignore IO errors on Windows
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
b8c7a7c7e5 Add format tests to pytest-bdd
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
e2bb8cf0de Add encryption test to pytest-bdd
- Clean up some formatting

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
3d3bd91700 Expand "we run" step to handling input better
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
e720430aa4 Implement "should" and "should not" handling
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
c76ee8cd4f Add more password tests to pytest-bdd
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
10b604ef89 Add more password tests to pytest-bdd
- Fix some input handling in steps (especially for passwords)
- Fix some formatting issues

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
6b27126c37 Implement password prompt steps in pytest-bdd
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
d0f92113f4 Add no keyring encryption test to pytest-bdd
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
fe018ee241 Implement test keyrings and add password tests
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
1c78a30535 Fix bug in makefile
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
921ebdcdd5 Update mocks in "we run" step
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
5ad5bac786 Standardize line breaks in datetime tests
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
40a1a871cb Migrate the rest of the delete tests from behave to pytest bdd
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
8754837f15 Add some functioning delete tests
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
7ccadebca0 Finish migrating datetime.feature to pytest bdd
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
a529ee5d06 Add another unreadable/readable date test
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
0c9b6cf85f Add unreadable date test
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
f686e2b9f0 Fix local config overwrite when running pytest bdd
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
7e6dd354cf Add unreadable date test
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Micah Jerome Ellison
7d04fb904a Add abbreviated weekday test
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
72170304ef Expand "we run" step in pytest-bdd
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
74ae5f039b Rename test functions for clarity
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
be05f96c26 Implement "the output should be" step
- Add another datetime test

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
6b096761e0 Re-enable test for windows on python 3.9
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
e257194d17 Add scenario outline test to datetime
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
7974f30261 Make tests move into temp dir as they run
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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
c500730ae6 Implement and add datetime tests
- 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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
7657bd7221 Implement version-checking test
- Add new step definition

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
3055cca767 Add tests for core feature to pytest-bdd
- Implement "the output should contain" step

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
0b50ae1be0 Rename features directory to data
This is more inline with pytest standards

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-07-03 15:49:18 -07:00
Jonathan Wren
530190df7a Implement handling of temp and working dirs
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>
2021-07-03 15:49:18 -07:00
Jonathan Wren
1390493a29 Install pytest-bdd (which will eventually replace behave)
- 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>
2021-07-03 15:49:18 -07:00
Jrnl Bot
ace6b8004c Update changelog [ci skip] 2021-07-03 22:22:37 +00:00
Ben Beasley
a9c539821f
Remove useless shebangs and executable permissions (#1283)
* Remove executable permissions from non-script files

* Remove harmless-but-useless shebang lines
2021-07-03 15:20:52 -07:00
Jrnl Bot
5e87ff1ce6 Update changelog [ci skip] 2021-06-05 20:16:47 +00:00
Micah Jerome Ellison
e84bb603eb
Ensure that line endings in all py files are Linux style instead of Windows (#1250) 2021-06-05 13:15:17 -07:00
dependabot[bot]
6fc252b2c7
Bump black from 21.5b1 to 21.5b2 (#1254)
Bumps [black](https://github.com/psf/black) from 21.5b1 to 21.5b2.
- [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)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-05 13:14:05 -07:00
Jrnl Bot
104fa2caca Update changelog [ci skip] 2021-05-29 18:48:21 +00:00
dependabot[bot]
17c7f4c648
Bump black from 21.5b0 to 21.5b1 (#1244)
Bumps [black](https://github.com/psf/black) from 21.5b0 to 21.5b1.
- [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)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-29 11:46:46 -07:00
Jrnl Bot
c6815621df Update changelog [ci skip] 2021-05-08 19:40:25 +00:00
dependabot[bot]
b38d765759
Bump black from 20.8b1 to 21.5b0 (#1241)
* Bump black from 20.8b1 to 21.5b0

Bumps [black](https://github.com/psf/black) from 20.8b1 to 21.5b0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/master/CHANGES.md)
- [Commits](https://github.com/psf/black/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* Run make format with latest version of black

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-05-08 12:39:00 -07:00
Jrnl Bot
f99387b3e5 Update changelog [ci skip] 2021-05-08 19:33:41 +00:00
dependabot[bot]
b66ce460b6
Bump pytest from 6.2.3 to 6.2.4 (#1240)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.3 to 6.2.4.
- [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.3...6.2.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-08 12:32:01 -07:00
Jrnl Bot
36db809588 Update changelog [ci skip] 2021-04-24 18:28:59 +00:00
Jonathan Wren
305127137a
Remove --version from brew release workflow (#1233)
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.
2021-04-24 11:27:32 -07:00
Jrnl Bot
e23909881a Update changelog [ci skip] 2021-04-24 18:09:15 +00:00
Jrnl Bot
0e9ae8ee8a Increment version to v2.8.1 2021-04-24 18:07:52 +00:00
Jrnl Bot
f13a0b5849 Update changelog [ci skip] 2021-04-20 02:26:27 +00:00
Jrnl Bot
a6362a993c Increment version to v2.8.1-beta 2021-04-20 02:24:47 +00:00
Manuel Ebert
4c5d59a5bc
Update index.html (#1229) 2021-04-14 22:47:10 -07:00
Jrnl Bot
192c05ce0d Update changelog [ci skip] 2021-04-10 23:51:26 +00:00
Suhas
dd74b14d76
More graceful handling of low linewrap values (#1219)
* 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
2021-04-10 16:49:56 -07:00
Jrnl Bot
1f19bd9f1e Update changelog [ci skip] 2021-04-10 18:52:04 +00:00
dependabot[bot]
202859cea1
Bump pytest from 6.2.2 to 6.2.3 (#1228)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.2 to 6.2.3.
- [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.2...6.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-10 11:50:37 -07:00
Jrnl Bot
eebadd188a Update changelog [ci skip] 2021-03-27 20:42:44 +00:00
dependabot[bot]
002a39db2a
Bump keyring from 23.0.0 to 23.0.1 (#1222)
Bumps [keyring](https://github.com/jaraco/keyring) from 23.0.0 to 23.0.1.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v23.0.0...v23.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-27 13:41:11 -07:00
dependabot[bot]
1e7d682df5
Bump pyflakes from 2.3.0 to 2.3.1 (#1221)
Bumps [pyflakes](https://github.com/PyCQA/pyflakes) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/PyCQA/pyflakes/releases)
- [Changelog](https://github.com/PyCQA/pyflakes/blob/master/NEWS.rst)
- [Commits](https://github.com/PyCQA/pyflakes/compare/2.3.0...2.3.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-27 13:40:49 -07:00
Jrnl Bot
e76762dd4d Update changelog [ci skip] 2021-03-27 20:24:44 +00:00
dependabot[bot]
6369026925
Bump cryptography from 3.4.6 to 3.4.7 (#1223)
Bumps [cryptography](https://github.com/pyca/cryptography) from 3.4.6 to 3.4.7.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.4.6...3.4.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-27 13:23:05 -07:00
Mandar Vaze
b357f935d4
Docs: Add emacs as external editor to recipes (#1220)
Add emacs as external editor to recipes
2021-03-27 13:21:44 -07:00
Jonathan Wren
09bcfa2242
Update brew tap for release pipeline
This was left out of a previous commit.

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-03-27 13:11:45 -07:00
Jrnl Bot
50c053cf56
Update changelog [ci skip] 2021-03-27 12:32:38 -07:00
Jrnl Bot
dc95b4c098
Increment version to v2.8 2021-03-27 12:32:37 -07:00
Jrnl Bot
eb0c694cc8
Update changelog [ci skip] 2021-03-27 12:32:36 -07:00
Jonathan Wren
e116a95e34
Change PR steps for brew release
The hub cli tool wasn't working anymore, so we took it out.

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
2021-03-27 12:32:31 -07:00
dependabot[bot]
f849805a73
Bump pyflakes from 2.2.0 to 2.3.0 (#1215)
Bumps [pyflakes](https://github.com/PyCQA/pyflakes) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/PyCQA/pyflakes/releases)
- [Changelog](https://github.com/PyCQA/pyflakes/blob/master/NEWS.rst)
- [Commits](https://github.com/PyCQA/pyflakes/compare/2.2.0...2.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-20 10:55:59 -07:00
Jonathan Wren
7bacf4a5f0
Changelog generator fixes
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>
2021-03-13 13:22:16 -08:00
Jrnl Bot
1c66ac2da2 Increment version to v2.8-beta 2021-03-13 19:29:14 +00:00
dependabot[bot]
98863bcc23
Bump keyring from 22.3.0 to 23.0.0 (#1213)
Bumps [keyring](https://github.com/jaraco/keyring) from 22.3.0 to 23.0.0.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v22.3.0...v23.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-13 11:09:59 -08:00
Jrnl Bot
1714d1eeef Increment version to v2.7.2-beta 2021-03-06 22:18:39 +00:00
Micah Jerome Ellison
df151d4dbc Add --local flag in git config calls 2021-03-06 14:05:48 -08:00
Micah Jerome Ellison
6639546413 Remove global flag from git config 2021-03-06 14:01:03 -08:00
Micah Jerome Ellison
06e5b4baf6
Fix broken brew release process (#1211)
* 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
2021-03-06 13:47:11 -08:00
Jrnl Bot
c3ddd7f2bf Update changelog [ci skip] 2021-03-06 18:48:31 +00:00
Suhas
a3f4f6b944
Fix bug that prevented --format pretty and --format short from working (#1177) 2021-03-06 10:47:03 -08:00
Jrnl Bot
b9a6d029e2 Update changelog [ci skip] 2021-03-06 15:20:14 +00:00
Micah Jerome Ellison
b9cf470871
Add pypi links for documentation, issue tracking, and funding (#1204) 2021-03-06 07:18:35 -08:00
Jrnl Bot
5a44385a54 Update changelog [ci skip] 2021-03-03 02:51:39 +00:00
dependabot[bot]
0560963c63
Bump keyring from 22.0.1 to 22.3.0 (#1210)
Bumps [keyring](https://github.com/jaraco/keyring) from 22.0.1 to 22.3.0.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v22.0.1...v22.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-02 18:49:50 -08:00
dependabot[bot]
1d222d67d5
Bump asteval from 0.9.22 to 0.9.23 (#1209)
Bumps [asteval](https://github.com/newville/asteval) from 0.9.22 to 0.9.23.
- [Release notes](https://github.com/newville/asteval/releases)
- [Commits](https://github.com/newville/asteval/compare/0.9.22...0.9.23)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-02 18:49:29 -08:00
Suhas
4f79803885
Allow runtime configuration overrides from the commandline (#1169)
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
2021-03-02 18:47:57 -08:00
Jrnl Bot
b99cebcee6 Update changelog [ci skip] 2021-02-27 19:05:55 +00:00
Jrnl Bot
2ac4bab4d5 Increment version to v2.7.1 2021-02-27 19:04:21 +00:00
Jrnl Bot
f7c78f63a0 Update changelog [ci skip] 2021-02-27 18:55:07 +00:00
Suhas
67682e7e93
Add per-journal config documentation (#1199)
* update documentation with example config

* make format

* clarify meaning of config
2021-02-27 10:53:21 -08:00
Jrnl Bot
e6c0a16342 Update changelog [ci skip] 2021-02-20 19:52:38 +00:00
Jrnl Bot
021ec61a81 Increment version to v2.7.1-beta 2021-02-20 19:50:52 +00:00
Jrnl Bot
0e90342b02 Update changelog [ci skip] 2021-02-20 19:32:09 +00:00
dependabot[bot]
487b0c44ae
Bump cryptography from 3.4.4 to 3.4.6 (#1195)
Bumps [cryptography](https://github.com/pyca/cryptography) from 3.4.4 to 3.4.6.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.4.4...3.4.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-20 11:30:33 -08:00
Jrnl Bot
76fd132409 Update changelog [ci skip] 2021-02-13 19:15:50 +00:00
dependabot[bot]
0d61e102c0
Bump asteval from 0.9.21 to 0.9.22 (#1189)
Bumps [asteval](https://github.com/newville/asteval) from 0.9.21 to 0.9.22.
- [Release notes](https://github.com/newville/asteval/releases)
- [Commits](https://github.com/newville/asteval/compare/0.9.21...0.9.22)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-13 11:14:13 -08:00
dependabot[bot]
3df5c62b5e
Bump cryptography from 3.3.1 to 3.4.4 (#1188)
Bumps [cryptography](https://github.com/pyca/cryptography) from 3.3.1 to 3.4.4.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.3.1...3.4.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-13 11:14:03 -08:00
dependabot[bot]
2244672e33
Bump yq from 2.11.1 to 2.12.0 (#1186)
Bumps [yq](https://github.com/kislyuk/yq) from 2.11.1 to 2.12.0.
- [Release notes](https://github.com/kislyuk/yq/releases)
- [Changelog](https://github.com/kislyuk/yq/blob/develop/Changes.rst)
- [Commits](https://github.com/kislyuk/yq/compare/v2.11.1...v2.12.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-13 11:13:24 -08:00
Micah Jerome Ellison
dc776b171a
Fix case on documentation tag in issue template 2021-02-06 14:10:21 -08:00
Jrnl Bot
3f3bdbeeda Update changelog [ci skip] 2021-02-06 20:19:19 +00:00
dependabot[bot]
115f790210
Bump pytz from 2020.5 to 2021.1 (#1174)
Bumps [pytz](https://github.com/stub42/pytz) from 2020.5 to 2021.1.
- [Release notes](https://github.com/stub42/pytz/releases)
- [Commits](https://github.com/stub42/pytz/compare/release_2020.5...release_2021.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-06 12:17:40 -08:00
Jrnl Bot
eca002ac29 Update changelog [ci skip] 2021-01-30 21:49:37 +00:00
dependabot[bot]
6e28b0b4a1
Bump keyring from 21.8.0 to 22.0.1 (#1168)
Bumps [keyring](https://github.com/jaraco/keyring) from 21.8.0 to 22.0.1.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v21.8.0...v22.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-30 13:48:08 -08:00
dependabot[bot]
fbb40b75f6
Bump pytest from 6.2.1 to 6.2.2 (#1167)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.1...6.2.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-30 13:47:37 -08:00
Jonathan Wren
ea845a8408
Make journal selection behavior more consistent when there's a colon with no date (#1164) 2021-01-30 13:47:26 -08:00
Jrnl Bot
ac0c49918d Update changelog [ci skip] 2021-01-30 21:34:06 +00:00
Micah Jerome Ellison
bd1c5c3f62
Add brew and gitter badges to README 2021-01-30 13:31:24 -08:00
eshrh
8a78c34917
Support title splitting for fullwidth CJK terminals (#1163)
* Split by fullwidth terminals without spaces.
* Add test
* Update write.feature
2021-01-23 15:29:43 -08:00
Jrnl Bot
ef563c807f Update changelog [ci skip] 2021-01-23 22:51:22 +00:00
256 changed files with 15199 additions and 6394 deletions

2
.gitattributes vendored
View file

@ -1,2 +1,4 @@
*.journal text eol=lf *.journal text eol=lf
*.feature text eol=lf *.feature text eol=lf
poetry.lock text eol=lf
pyrpoject.toml text eol=lf

View file

@ -1,42 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ":new:, bug"
assignees: ''
---
## Bug Report
<!--
Hello, and thank you for reporting an issue!
Please fill out the points below, as it will make our process much easier.
-->
<!-- Please tell us about your environment -->
### Environment
- `jrnl --diagnostic` output: <!-- Run the command and paste the output here -->
- Install method: <!-- How did you install jrnl? (pipx, brew, etc) -->
### Current Behavior
<!--
Please put a short description of what is currently happening.
-->
### Expected Behavior
<!--
Please write a short description of what you would expect to happen
(instead of what is currently happening).
-->
### Repro Steps
<!--
Please provide the steps to reproduce the problem. It is important for you to
be as precise as possible here, since more info will let us help you faster.
If applicable, please run jrnl with --debug and paste the output.
-->
### Other Information
<!-- (e.g. more detailed explanation, stacktraces, related
issues, suggestions how to fix, links for us to have context, eg.
stackoverflow, gitter, etc) -->

74
.github/ISSUE_TEMPLATE/bug_report.yaml vendored Normal file
View file

@ -0,0 +1,74 @@
name: Bug Report
description: Create a report to help us improve
title: "Bug Report"
labels: [ ":new:", "bug" ]
body:
- type: markdown
attributes:
value: |
# Bug Report
Hello, and thank you for reporting an issue!
Please fill out the points below, as it will make our process much easier.
- type: textarea
id: diagnostic
attributes:
label: Diagnostic output
description: Run `jrnl --diagnostic` and paste the output below
placeholder: Paste output here
validations:
required: true
- type: textarea
id: current-behavior
attributes:
label: Current Behavior
description: Please put a short description of what is currently happening.
placeholder: Tell us what is happening
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: Please write a short description of what you would expect to happen
placeholder: Tell us what should be happening
validations:
required: true
- type: textarea
id: repro-steps
attributes:
label: Repro Steps
description: |
Provide the steps to reproduce the problem.
Please be as precise as possible, since more info will let us help you faster.
placeholder: Repro steps
validations:
required: true
- type: textarea
id: debug-output
attributes:
label: Debug output
description: |
Please provide the output of your command with the `--debug` flag on.
placeholder: "example: `jrnl --debug lorem ipsum`"
validations:
required: true
- type: textarea
id: other-info
attributes:
label: Other Information
description: >
Is there anything else we should know?
(e.g. more detailed explanation, stacktraces, related
issues, suggestions how to fix, links for us to have context, eg.
stackoverflow, gitter, etc)
validations:
required: false

View file

@ -1,31 +0,0 @@
---
name: Documentation Change
about: Request or report any updates to our documentation (https://jrnl.sh)
title: ''
labels: ":new:, Documentation"
assignees: ''
---
## Documentation Change
<!--
Hello, and thank you for reporting an issue!
Please fill out the points below, as it will make our process much easier.
-->
### Affected Page(s)
<!--
Please tell us which page, or pages, from the documentation site (https://jrnl.sh) are
affected in this issue
-->
- <!-- example: https://jrnl.sh/en/stable/overview -->
### What Could Be Better?
<!--
Please write a short description of what you hope can be clarified or further explained.
-->
### Other Information
<!--
Is there anything else we should know that might be helpful?
-->

View file

@ -0,0 +1,41 @@
name: Documentation Change
description: Request or report any updates to our documentation (https://jrnl.sh)
title: Documentation Change
labels: [ ":new:", "documentation" ]
body:
- type: markdown
attributes:
value: |
# Documentation Change
Hello, and thank you for reporting an issue!
Please fill out the points below, as it will make our process much easier.
- type: textarea
id: affected-pages
attributes:
label: Affected Page(s)
description: >
Please tell us which page, or pages, from the documentation site
(https://jrnl.sh) are affected in this issue
placeholder: "example: https://jrnl.sh/en/stable/overview"
validations:
required: true
- type: textarea
id: what-could-be-better
attributes:
label: What Could Be Better?
description: >
Please write a short description of what you hope can be clarified or
further explained.
validations:
required: true
- type: textarea
id: other-info
attributes:
label: Other Information
description: Is there anything else we should know that might be helpful?
validations:
required: false

View file

@ -1,31 +0,0 @@
---
name: Feature request
about: Suggest an idea for jrnl
title: ''
labels: ":new:, enhancement"
assignees: ''
---
## Feature Request
<!--
Hello, and thank you for reporting an issue!
Please fill out the points below, as it will make our process much easier.
-->
### Use Case/Motivation
<!--
What is the motivation / use case for changing the behavior?
-->
### Example Usage
<!--
Please provide examples of the usage you would like to see.
e.g `jrnl --new-flag="super cool new feature"`
-->
### Other information
<!--
Please provide any other relevant info about this request (e.g. stacktraces,
related issues, suggestions how to fix, etc)
-->

View file

@ -0,0 +1,43 @@
name: Feature Request
description: Suggest an idea for jrnl
title: "Feature Report"
labels: [ ":new:", "enhancement" ]
body:
- type: markdown
attributes:
value: |
# Feature Request
Hello, and thank you for reporting an issue!
Please fill out the points below, as it will make our process much easier.
- type: textarea
id: user-case
attributes:
label: Use Case/Motivation
description: What is the motivation / use case for changing the behavior?
placeholder: Tell us about your idea
validations:
required: true
- type: textarea
id: example-usage
attributes:
label: Example Usage
description: Please provide examples of the usage you would like to see.
placeholder: e.g `jrnl --new-flag="super cool new feature"`
validations:
required: true
- type: textarea
id: other-info
attributes:
label: Other Information
description: >
Is there anything else we should know?
(e.g. more detailed explanation, stacktraces, related
issues, suggestions how to fix, links for us to have context, eg.
stackoverflow, gitter, etc)
validations:
required: false

View file

@ -1,40 +0,0 @@
---
name: Support Request
about: Get help with jrnl
title: ''
labels: ":new:, support"
assignees: ''
---
## Support Request
<!--
Hello, and thank you for reporting an issue!
Please fill out the points below, as it will make our process much easier.
-->
### Environment
<!--
Please tell us about your environment
-->
- Jrnl `--diagnostic` output: <!-- Run `jrnl --diagnostic` and paste the output -->
- Install method: <!-- How did you install jrnl? (pipx, brew, etc) -->
### What are you trying to do?
<!--
Please write a short description of what is happening.
-->
### What have you tried?
<!--
Have you tried anything to fix the problem? This can help give us more
information to help you with.
-->
### Other Information
<!--
If applicable, please run jrnl with --debug and paste the output.
Is there anything else we should know that might be helpful?
e.g. detailed explanation, stacktraces, related issues, suggestions how to fix
-->

View file

@ -0,0 +1,54 @@
name: Support Request
description: Get help with jrnl
title: Support Request
labels: [ ":new:", "support" ]
body:
- type: markdown
attributes:
value: |
# Support Request
Hello, and thank you for reporting an issue!
Please fill out the points below, as it will make our process much easier.
- type: textarea
id: diagnostic
attributes:
label: Diagnostic output
description: Run `jrnl --diagnostic` and paste the output below
placeholder: Paste output here
validations:
required: true
- type: textarea
id: current-behavior
attributes:
label: What are you trying to do?
description: Please put a short description of what is happening.
placeholder: Tell us what is happening
validations:
required: true
- type: textarea
id: tried
attributes:
label: What have you tried?
description: >
Have you tried anything to fix the problem? This can help give us more
information to help you with.
placeholder: Tell us what should be happening
validations:
required: true
- type: textarea
id: other-info
attributes:
label: Other Information
description: >
Is there anything else we should know?
(e.g. more detailed explanation, stacktraces, related
issues, suggestions how to fix, links for us to have context, eg.
stackoverflow, gitter, etc)
validations:
required: false

View file

@ -12,15 +12,13 @@ Here are some key points to include in your description:
### Checklist ### Checklist
- [ ] I have read the [contributing doc](https://github.com/jrnl-org/jrnl/blob/develop/CONTRIBUTING.md). - [ ] I have read the [contributing doc](https://github.com/jrnl-org/jrnl/blob/develop/docs/contributing.md).
- [ ] I have included a link to the relevant issue number. - [ ] I have included a link to the relevant issue number.
- [ ] I have tested this code locally.
- [ ] I have checked to ensure there aren't other open [pull requests](../pulls) - [ ] I have checked to ensure there aren't other open [pull requests](../pulls)
for the same issue. for the same issue.
- [ ] I have written new tests for these changes, as needed. - [ ] I have written new tests for these changes, as needed.
- [ ] All tests pass.
<!-- <!--
NOTE: Your PR may not be reviewed if there are any failing tests. You can run NOTE: Your PR may not be reviewed if there are any failing tests. You can run
tests locally with `make test` (see the contributing doc if you need help with tests locally with `poe test` (see the contributing doc if you need help with
`make`), or use our automated tests after you submit your PR. `poe`), or use our automated tests after you submit your PR.
--> -->

17
.github/actionlint-matcher.json vendored Normal file
View file

@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "actionlint",
"pattern": [
{
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
}
]
}

46
.github/actions/run_tests/action.yaml vendored Normal file
View file

@ -0,0 +1,46 @@
name: run jrnl tests
description: Runs all jrnl tests on multiple platforms
inputs:
cache-string:
description: 'Cache string secret. Change to bust the cache'
required: true
runs:
using: "composite"
steps:
- run: git config --global core.autocrlf false
shell: bash
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Capture full Python version in env
run: echo "PYTHON_FULL_VERSION=$(python --version)" >> $GITHUB_ENV
shell: bash
- name: poetry cache # Change CACHE_STRING secret to bust the cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ env.PYTHON_FULL_VERSION }}-${{ inputs.cache-string }}
- name: Install dependencies
run: |
echo '::group::poetry'
pip --disable-pip-version-check install poetry
poetry config --local virtualenvs.in-project true
echo '::endgroup::'
echo '::group::Other dependencies'
poetry sync
echo '::endgroup::'
echo 'DEPS_INSTALLED=true' >> $GITHUB_ENV
shell: bash
- name: Linting & Testing
if: ${{ env.DEPS_INSTALLED == 'true' }}
run: poetry run poe test
shell: bash

View file

@ -1,12 +0,0 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
reviewers:
- wren
- micahellison
labels:
- packaging

14
.github/renovate.json vendored Normal file
View file

@ -0,0 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"schedule": [ "at any time" ],
"prConcurrentLimit": 10,
"prHourlyLimit": 10,
"reviewers": [
"wren",
"micahellison"
],
"labels": [ "packaging" ]
}

View file

@ -1,3 +1,6 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
name: Changelog name: Changelog
on: on:
@ -18,7 +21,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
token: ${{ secrets.JRNL_BOT_TOKEN }} token: ${{ secrets.JRNL_BOT_TOKEN }}
@ -49,14 +52,14 @@ jobs:
if [[ ! ${GITHUB_REF##*/} =~ $prerelease_regex ]]; then if [[ ! ${GITHUB_REF##*/} =~ $prerelease_regex ]]; then
echo '::debug::Actual release (not a prerelease)' echo '::debug::Actual release (not a prerelease)'
TAG_REGEX="$prerelease_regex" TAG_REGEX="$prerelease_regex"
echo "FULL_RELEASE=true" >> $GITHUB_ENV echo "FULL_RELEASE=true" >> "$GITHUB_ENV"
fi fi
fi fi
echo "::debug::TAG_REGEX: $TAG_REGEX" echo "::debug::TAG_REGEX: $TAG_REGEX"
if [[ "$(git rev-parse "origin/$BRANCH")" != $GITHUB_SHA ]]; then if [[ "$(git rev-parse "origin/$BRANCH")" != "$GITHUB_SHA" ]]; then
# Normal build on a branch (no tag) # Normal build on a branch (no tag)
echo "::debug::BRANCH: $BRANCH $(git rev-parse origin/$BRANCH)" echo "::debug::BRANCH: $BRANCH $(git rev-parse "origin/$BRANCH")"
echo "::debug::GITHUB_SHA: $GITHUB_SHA" echo "::debug::GITHUB_SHA: $GITHUB_SHA"
echo "::error::$BRANCH has been updated since build started. Aborting changelog." echo "::error::$BRANCH has been updated since build started. Aborting changelog."
exit 1 exit 1
@ -69,10 +72,12 @@ jobs:
echo "::debug::FILENAME: CHANGELOG.md" echo "::debug::FILENAME: CHANGELOG.md"
echo "::debug::SINCE_TAG: $SINCE_TAG" echo "::debug::SINCE_TAG: $SINCE_TAG"
echo "BRANCH=$BRANCH" >> $GITHUB_ENV {
echo "TAG_REGEX=$TAG_REGEX" >> $GITHUB_ENV echo "BRANCH=$BRANCH"
echo "FILENAME=CHANGELOG.md" >> $GITHUB_ENV echo "TAG_REGEX=$TAG_REGEX"
echo "SINCE_TAG=$SINCE_TAG" >> $GITHUB_ENV echo "FILENAME=CHANGELOG.md"
echo "SINCE_TAG=$SINCE_TAG"
} >> "$GITHUB_ENV"
- name: Prep changelog file (clear out old lines) - name: Prep changelog file (clear out old lines)
run: | run: |
@ -85,7 +90,14 @@ jobs:
exit 1 exit 1
fi fi
sed -i "1,$(expr $tagline - 1)d" "$FILENAME" if [[ $tagline == 1 ]]; then
echo "::error::Something is wrong."
echo "::error::The latest release ${SINCE_TAG} is the first line in the changelog,"
echo "::error::but the h1 '# Changelog' should always be the first line."
exit 1
fi
sed -i "1,$(( tagline - 1 ))d" "$FILENAME"
# delete generated line (or it will be added multiple times) # delete generated line (or it will be added multiple times)
sed -i '/This Changelog was automatically generated by/d' "$FILENAME" sed -i '/This Changelog was automatically generated by/d' "$FILENAME"
# delete trailing empty lines # delete trailing empty lines
@ -124,25 +136,35 @@ jobs:
git diff git diff
if [[ $(grep -c '^# Changelog$' "$FILENAME") != 1 ]]; then if [[ $(grep -c '^# Changelog$' "$FILENAME") != 1 ]]; then
echo '::error::Something is wrong with the changelog.' echo '::error::Something is wrong with the changelog.'
exit 1
fi fi
SOMETHING_CHANGED=false SOMETHING_CHANGED=false
git diff --exit-code || SOMETHING_CHANGED=true git diff --exit-code || SOMETHING_CHANGED=true
echo "::debug::SOMETHING_CHANGED: $SOMETHING_CHANGED" echo "::debug::SOMETHING_CHANGED: $SOMETHING_CHANGED"
echo "SOMETHING_CHANGED=$SOMETHING_CHANGED" >> $GITHUB_ENV echo "SOMETHING_CHANGED=$SOMETHING_CHANGED" >> "$GITHUB_ENV"
- name: Commit - name: Commit
if: env.SOMETHING_CHANGED == 'true' if: env.SOMETHING_CHANGED == 'true'
run: | run: |
git config user.email "jrnl.bot@gmail.com" git config --global user.name "${{ secrets.JRNL_BOT_NAME }}"
git config user.name "Jrnl Bot" git config --global user.email "${{ secrets.JRNL_BOT_EMAIL }}"
git add "$FILENAME" git add "$FILENAME"
git commit -m "Update changelog [ci skip]" git commit -m "Update changelog [ci skip]"
git push origin $BRANCH git push origin "$BRANCH"
- name: Update tag to include changelog
if: startsWith(env.GITHUB_REF, 'refs/tags/')
run: |
# This is a tag build (releases and prereleases)
# update the tag to include the changelog
git tag -fam "$GITHUB_REF_NAME" "$GITHUB_REF_NAME"
git push --tags --force
- name: Merge to Release branch - name: Merge to Release branch
if: env.FULL_RELEASE == 'true' if: env.FULL_RELEASE == 'true'
run: | run: |
git fetch --unshallow origin
git checkout release git checkout release
git merge --ff-only $BRANCH git merge --ff-only "$BRANCH"
git push origin release git push origin release

View file

@ -1,3 +1,6 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
name: Docs name: Docs
on: on:
@ -9,6 +12,8 @@ on:
- 'mkdocs.yml' - 'mkdocs.yml'
- 'readthedocs.yml' - 'readthedocs.yml'
- '.github/workflows/docs.yaml' - '.github/workflows/docs.yaml'
- 'tasks.py'
- 'pyproject.toml'
pull_request: pull_request:
branches: [ develop ] branches: [ develop ]
paths: paths:
@ -17,31 +22,41 @@ on:
- 'mkdocs.yml' - 'mkdocs.yml'
- 'readthedocs.yml' - 'readthedocs.yml'
- '.github/workflows/docs.yaml' - '.github/workflows/docs.yaml'
- 'tasks.py'
- 'pyproject.toml'
jobs: jobs:
accessibility: accessibility:
if: contains(toJson(github.event.commits), '[ci skip]') == false if: contains(toJson(github.event.commits), '[ci skip]') == false
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: [ '3.11' ]
os: [ ubuntu-latest ]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v5
with: with:
python-version: 3.9 python-version: ${{ matrix.python-version }}
- name: Setup Node.js environment - name: Setup Node.js environment
uses: actions/setup-node@main uses: actions/setup-node@main
- name: Capture full Python version in env
run: echo "PYTHON_FULL_VERSION=$(python --version)" >> "$GITHUB_ENV"
- name: poetry cache - name: poetry cache
uses: actions/cache@v2 uses: actions/cache@v4
with: with:
path: .venv path: .venv
key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ matrix.python-version }} key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ env.PYTHON_FULL_VERSION }}-${{ secrets.CACHE_STRING }}
- name: npm cache - name: npm cache
uses: actions/cache@v2 uses: actions/cache@v4
with: with:
path: node_modules path: node_modules
key: ${{ runner.os }}-pa11y-v3 key: ${{ runner.os }}-pa11y-v3
@ -50,19 +65,12 @@ jobs:
run: | run: |
pip install poetry pip install poetry
poetry config --local virtualenvs.in-project true poetry config --local virtualenvs.in-project true
poetry install --no-root --remove-untracked poetry sync --no-root
npm install pa11y-ci npm install
echo "node_modules/.bin" >> $GITHUB_PATH echo "node_modules/.bin" >> "$GITHUB_PATH"
- name: Start docs server - name: Start docs server
run: poetry run mkdocs serve & run: poetry run poe docs-run &
- name: Generate sitemap
env:
site_url: http://127.0.0.1:8000
run: |
select="{urls: [\"${site_url}/\", \"${site_url}/search.html?q=jrnl\", .urlset.url[].loc]}"
curl -s "$site_url/sitemap.xml" | poetry run xq "$select" > list.json
- name: Accessibility testing (Pa11y) - name: Accessibility testing (Pa11y)
run: pa11y-ci -c list.json run: poetry run poe docs-check

View file

@ -1,20 +1,22 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
name: Release name: Release
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
description: 'Version (e.g. v2.5, v2.5.1-beta, v2.6-beta2)' description: 'Version (e.g. v2.5, v2.5.1-beta, v2.6-beta2)'
type: string
required: true required: true
include_repo_version: include_repo_version:
description: 'Update version in repo? (true/false)' description: 'Update version in repo?'
require: true type: boolean
default: true
include_pypi:
description: 'Publish to PyPI? (true/false)'
required: true required: true
default: true default: true
include_brew: include_pypi:
description: 'Publish to Homebrew? (true/false)' description: 'Publish to PyPI?'
type: boolean
required: true required: true
default: true default: true
@ -56,15 +58,15 @@ jobs:
run: | run: |
JRNL_VERSION="${{ github.event.inputs.version }}" JRNL_VERSION="${{ github.event.inputs.version }}"
echo "::debug::version: $JRNL_VERSION" echo "::debug::version: $JRNL_VERSION"
echo "JRNL_VERSION=$JRNL_VERSION" >> $GITHUB_ENV echo "JRNL_VERSION=$JRNL_VERSION" >> "$GITHUB_ENV"
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v5
with: with:
python-version: 3.9 python-version: '3.13'
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
token: ${{ secrets.JRNL_BOT_TOKEN }} token: ${{ secrets.JRNL_BOT_TOKEN }}
@ -80,7 +82,7 @@ jobs:
if: ${{ github.event.inputs.include_repo_version == 'true' }} if: ${{ github.event.inputs.include_repo_version == 'true' }}
run: | run: |
poetry version "$JRNL_VERSION" poetry version "$JRNL_VERSION"
echo __version__ = \"$JRNL_VERSION\" > jrnl/__version__.py echo "__version__ = \"$JRNL_VERSION\"" > jrnl/__version__.py
- name: Commit updated files - name: Commit updated files
if: ${{ github.event.inputs.include_repo_version == 'true' && github.repository == env.HOME_REPO }} if: ${{ github.event.inputs.include_repo_version == 'true' && github.repository == env.HOME_REPO }}
@ -103,131 +105,5 @@ jobs:
- name: Get PyPI version - name: Get PyPI version
id: pypi-version-getter id: pypi-version-getter
run: | run: |
pypi_version="$(ls dist/jrnl-*.tar.gz | sed -r 's!dist/jrnl-(.*)\.tar\.gz!\1!')" pypi_version="$(find dist/jrnl-*.tar.gz | sed -r 's!dist/jrnl-(.*)\.tar\.gz!\1!')"
echo "::set-output name=pypi_version::$pypi_version" echo "pypi_version=$pypi_version" >> "$GITHUB_OUTPUT"
release_homebrew:
if: ${{ github.event.inputs.include_brew == 'true' }}
needs: release_pypi
name: "Release to Homebrew"
runs-on: macos-latest
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOME_REPO: ${{ secrets.HOME_REPO }}
steps:
- name: Get version
run: |
JRNL_VERSION="${{ github.event.inputs.version }}"
PYPI_VERSION="${{ needs.release_pypi.outputs.pypi_version }}"
echo "::debug::jrnl version: $JRNL_VERSION"
echo "::debug::pypi version: $PYPI_VERSION"
echo "JRNL_VERSION=$JRNL_VERSION" >> $GITHUB_ENV
echo "PYPI_VERSION=$PYPI_VERSION" >> $GITHUB_ENV
- name: Determine type of release
env:
REPO_OWNER: ${{ github.repository_owner }}
run: |
if [[ $JRNL_VERSION =~ (alpha|beta) ]]; then
echo '::debug::Prerelease (not a full release)'
{
echo "RELEASE_TYPE=pre"
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-prerelease"
echo "BOT_REPO=jrnl-bot/homebrew-prerelease"
echo "FORMULA_NAME=jrnl-beta"
} >> $GITHUB_ENV
else
echo '::debug::Full release (not a prerelease)'
if [[ "${{ github.repository }}" == "${HOME_REPO}" ]]; then
REPO_OWNER="homebrew"
fi
{
echo "RELEASE_TYPE=full"
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-core"
echo "BOT_REPO=jrnl-bot/homebrew-core"
echo "FORMULA_NAME=jrnl"
} >> $GITHUB_ENV
fi
- name: Checkout homebrew repo
uses: actions/checkout@v2
with:
token: ${{ secrets.JRNL_BOT_TOKEN }}
repository: ${{ env.FORMULA_REPO }}
- name: Config git user
run: |
git config --global user.name "${{ secrets.JRNL_BOT_NAME }}"
git config --global user.email "${{ secrets.JRNL_BOT_EMAIL }}"
- name: Create branch
run: |
BRANCH_NAME="jrnl-${JRNL_VERSION}--${RANDOM}"
git remote rename origin upstream
git remote add origin "https://github.com/${BOT_REPO}.git"
git fetch --unshallow upstream
git fetch origin
git checkout -b $BRANCH_NAME
git push -u origin $BRANCH_NAME
- name: Install dependencies
run: brew install pipgrip
- name: Query PyPI API
uses: nick-invision/retry@v2
with:
timeout_seconds: 10
max_attempts: 30
retry_wait_seconds: 10
command: |
curl -Ls https://pypi.org/pypi/jrnl/json > api_response.json
# if query doesn't have our version yet, give it some time before trying again
if [[ "null" == "$(jq ".releases[\"${PYPI_VERSION}\"][1].url" -r api_response.json)" ]]; then
echo "::debug::PYPI_VERSION: $PYPI_VERSION"
echo "::debug::JQ VALUE: $(jq ".releases[\"${PYPI_VERSION}\"][1].url" -r api_response.json)"
echo "::group::cat api_response.json"
cat api_response.json
echo "::endgroup::"
exit 1
fi
- name: Update Homebrew Formula
uses: nick-invision/retry@v2
with:
timeout_minutes: 8
max_attempts: 6
retry_wait_seconds: 30
command: >
brew bump-formula-pr "Formula/${FORMULA_NAME}.rb"
--url $(jq ".releases[\"${PYPI_VERSION}\"][1].url" -r api_response.json)
--sha256 $(jq ".releases[\"${PYPI_VERSION}\"][1].digests.sha256" -r api_response.json)
--version=$PYPI_VERSION
--no-audit
--write
--commit
--force
--verbose
- name: Update commit message
run: |
git commit --amend \
-m "jrnl ${JRNL_VERSION}" \
-m "Update jrnl to ${JRNL_VERSION}" \
-m '${{ secrets.RELEASE_COAUTHORS }}'
- name: Push commit
run: |
git show head
git push
- name: Open pull request
env:
GH_TOKEN: ${{ secrets.JRNL_BOT_TOKEN }}
run: >
gh pr create
--title "jrnl ${JRNL_VERSION}"
--body 'Created with `brew bump-formula-pr`.'

View file

@ -1,72 +0,0 @@
name: Testing
on:
push:
branches: [ develop, release ]
paths:
- 'jrnl/**'
- 'features/**'
- 'tests/**'
- 'poetry.lock'
- 'pyproject.toml'
pull_request:
branches: [ develop ]
paths:
- 'jrnl/**'
- 'features/**'
- 'tests/**'
- 'poetry.lock'
- 'pyproject.toml'
jobs:
test:
if: >
! contains(github.event.head_commit.message, '[ci skip]')
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
exclude: # Added for GitHub Actions PR problem 2020-12-19 -- remove later!
- os: windows-latest
python-version: 3.9
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: poetry cache
uses: actions/cache@v2
with:
path: .venv
key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ matrix.python-version }}-v2
- name: Install dependencies
run: |
pip install poetry
poetry config --local virtualenvs.in-project true
poetry install --remove-untracked
- name: Code formatting (Black)
if: success() || failure()
run: |
poetry run black --version
poetry run black --check --diff .
- name: Code Style (PyFlakes)
if: success() || failure()
run: |
poetry run pyflakes --version
poetry run pyflakes jrnl features tests
- name: Test with pytest
if: success() || failure()
run: poetry run pytest --junitxml=reports/pytest/results.xml
- name: Test with behave
if: success() || failure()
run: poetry run behave --no-skipped --format progress2 --junit --junit-directory reports/behave

View file

@ -0,0 +1,35 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
name: Testing Pipeline Files
on:
push:
branches: [ develop, release ]
paths:
- '.github/workflows/**'
- '.github/actions/**'
pull_request:
branches: [ develop ]
paths:
- '.github/workflows/**'
- '.github/actions/**'
schedule:
- cron: '0 0 * * SAT'
jobs:
test:
if: >
! contains(github.event.head_commit.message, '[ci skip]')
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- name: Check workflow files
uses: docker://rhysd/actionlint:latest
with:
args: -color

48
.github/workflows/testing_prs.yaml vendored Normal file
View file

@ -0,0 +1,48 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
name: Testing
on:
push:
branches: [ develop, release ]
paths:
- 'jrnl/**'
- 'features/**'
- 'tests/**'
- 'poetry.lock'
- 'pyproject.toml'
- '.github/workflows/testing_prs.yaml'
- 'tasks.py'
pull_request:
branches: [ develop ]
paths:
- 'jrnl/**'
- 'features/**'
- 'tests/**'
- 'poetry.lock'
- 'pyproject.toml'
- '.github/workflows/testing_prs.yaml'
- 'tasks.py'
defaults:
run:
shell: bash # needed to prevent Windows from using PowerShell
jobs:
test:
if: >
! contains(github.event.head_commit.message, '[ci skip]')
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- name: Run tests
uses: ./.github/actions/run_tests
with:
cache-string: ${{ secrets.CACHE_STRING }}

28
.github/workflows/testing_schedule.yaml vendored Normal file
View file

@ -0,0 +1,28 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
name: Testing
on:
schedule:
- cron: '0 0 * * SAT'
defaults:
run:
shell: bash # needed to prevent Windows from using PowerShell
jobs:
test_all:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- name: Run tests
uses: ./.github/actions/run_tests
with:
cache-string: ${{ secrets.CACHE_STRING }}

71
.gitignore vendored
View file

@ -1,56 +1,63 @@
# Byte-compiled DLL and Shared Library files
*.py[cod] *.py[cod]
# C extensions
*.so *.so
.python-version
# Packages # Packages
*.egg *.egg
*.egg-info *.egg-info/
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg .installed.cfg
lib bin/
lib64 build/
develop-eggs/
dist/
eggs/
lib64/
parts/
sdist/
.tox/
var/
node_modules/
__pycache__/
.pytest_cache/
.flakeheaven_cache/
# Versioning
.python-version .python-version
.tool-versions
# Installer logs # Installer logs
pip-log.txt
.DS_Store .DS_Store
.travis-solo .travis-solo
Icon Icon
pip-log.txt
# Documentation # Documentation
_build _build
_sources _sources
_static _static
coverage.xml
exp/
objects.inv objects.inv
searchindex.js searchindex.js
# MS Visual Studio (PyTools) # virtualenv
obj .venv*/
*.pyproj
*.sln
*.suo
# virtaulenv
env/ env/
env*/ env*/
venv*/ venv*/
.venv*/
# PyCharm Project files # Editor and IDE specific files
.idea/ # Since contributors may want to user a variety of development tools it is
# recommended that editor specific file types be ignored globally by each
# export testing directories # contributor via a global gitignore. Instructions for setting up a global
exp/ # ignore file can be found here:
# https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
_extras/ # (Configuring ignored files for all repositories on your computer)
*.sublime-* # Examples of such files are:
site/ # MS Visual Studio (PyTools)
# obj
# *.suo
# PyCharm
# .idea/
# VS Code
# .vscode/settings.json

View file

@ -5,6 +5,13 @@
# Required # Required
version: 2 version: 2
# Set the OS
build:
os: ubuntu-22.04
tools:
python: "3"
# Build documentation in the docs/ directory # Build documentation in the docs/ directory
mkdocs: mkdocs:
configuration: mkdocs.yml configuration: mkdocs.yml
@ -17,6 +24,5 @@ formats:
# Optionally set the version of Python and requirements required to build your docs # Optionally set the version of Python and requirements required to build your docs
python: python:
version: 3.7
install: install:
- requirements: docs_theme/requirements.txt - requirements: docs_theme/requirements.txt

View file

@ -2,45 +2,567 @@
## [Unreleased](https://github.com/jrnl-org/jrnl/) ## [Unreleased](https://github.com/jrnl-org/jrnl/)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7-beta...HEAD) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.2.1...HEAD)
**Fixed bugs:** **Fixed bugs:**
- Editor can't be launched on Windows when using full path to editor executable [\#1096](https://github.com/jrnl-org/jrnl/issues/1096) - poetry warning - "poetry.dev-dependencies" section is deprecated [\#1975](https://github.com/jrnl-org/jrnl/issues/1975)
- Homebrew autobump error on jrnl release [\#1961](https://github.com/jrnl-org/jrnl/issues/1961)
**Build:** **Build:**
- Fix homebrew release, add options for release pipeline [\#1154](https://github.com/jrnl-org/jrnl/pull/1154) ([wren](https://github.com/wren)) - Remove release step to publish to Homebrew [\#1994](https://github.com/jrnl-org/jrnl/pull/1994) ([micahellison](https://github.com/micahellison))
**Documentation:**
- add instructions to add VSCode as an external editor for Windows [\#1155](https://github.com/jrnl-org/jrnl/issues/1155)
- Clarify editor documentation for PATH variable and VS Code [\#1160](https://github.com/jrnl-org/jrnl/pull/1160) ([micahellison](https://github.com/micahellison))
**Packaging:** **Packaging:**
- Bump pyyaml from 5.3.1 to 5.4.1 [\#1158](https://github.com/jrnl-org/jrnl/pull/1158) ([dependabot[bot]](https://github.com/apps/dependabot)) - Update dependency rich to v14 [\#1989](https://github.com/jrnl-org/jrnl/pull/1989) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency python to 3.13 [\#1988](https://github.com/jrnl-org/jrnl/pull/1988) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tox to v4.25.0 [\#1986](https://github.com/jrnl-org/jrnl/pull/1986) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tzlocal to v5.3.1 [\#1984](https://github.com/jrnl-org/jrnl/pull/1984) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency jinja2 to v3.1.6 [\#1983](https://github.com/jrnl-org/jrnl/pull/1983) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency poethepoet to v0.33.1 [\#1982](https://github.com/jrnl-org/jrnl/pull/1982) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest to v8.3.5 [\#1981](https://github.com/jrnl-org/jrnl/pull/1981) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency cryptography to v44.0.2 [\#1980](https://github.com/jrnl-org/jrnl/pull/1980) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruff to v0.11.3 [\#1978](https://github.com/jrnl-org/jrnl/pull/1978) ([renovate[bot]](https://github.com/apps/renovate))
## [v2.7-beta](https://pypi.org/project/jrnl/v2.7-beta/) (2021-01-16) ## [v4.2.1](https://pypi.org/project/jrnl/v4.2.1/) (2025-02-25)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.6...v2.7-beta) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.2...v4.2.1)
**Documentation:**
- Typing animation in landing page is broken [\#1969](https://github.com/jrnl-org/jrnl/issues/1969)
**Packaging:**
- Update dependency pytest to \>=8.1.1 [\#1974](https://github.com/jrnl-org/jrnl/pull/1974) ([wren](https://github.com/wren))
- Update dependency black to v25 [\#1973](https://github.com/jrnl-org/jrnl/pull/1973) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tzlocal to v5.3 [\#1972](https://github.com/jrnl-org/jrnl/pull/1972) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruamel.yaml to v0.18.10 [\#1967](https://github.com/jrnl-org/jrnl/pull/1967) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency jinja2 to v3.1.5 [\#1966](https://github.com/jrnl-org/jrnl/pull/1966) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency cryptography to v44 [\#1962](https://github.com/jrnl-org/jrnl/pull/1962) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest-bdd to v8.1.0 [\#1952](https://github.com/jrnl-org/jrnl/pull/1952) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency poethepoet to v0.32.2 [\#1951](https://github.com/jrnl-org/jrnl/pull/1951) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency keyring to v25.6.0 [\#1948](https://github.com/jrnl-org/jrnl/pull/1948) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruff to v0.9.7 [\#1947](https://github.com/jrnl-org/jrnl/pull/1947) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency rich to v13.9.4 [\#1946](https://github.com/jrnl-org/jrnl/pull/1946) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tox to v4.24.1 [\#1945](https://github.com/jrnl-org/jrnl/pull/1945) ([renovate[bot]](https://github.com/apps/renovate))
## [v4.2](https://pypi.org/project/jrnl/v4.2/) (2024-11-17)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.2-beta...v4.2)
**Implemented enhancements:**
- Add Python 3.13 support [\#1893](https://github.com/jrnl-org/jrnl/issues/1893)
- Add calendar heatmap display format [\#1759](https://github.com/jrnl-org/jrnl/pull/1759) ([alichtman](https://github.com/alichtman))
**Fixed bugs:**
- -contains doesn't accept multiple search terms, doesn't work with -and [\#1877](https://github.com/jrnl-org/jrnl/issues/1877)
- Tests failing on develop branch starting with pytest-bdd 7.1.2 [\#1875](https://github.com/jrnl-org/jrnl/issues/1875)
- Ignore color when used in a pipeline [\#1839](https://github.com/jrnl-org/jrnl/issues/1839)
- Fix -contains to allow multiple terms with "OR" logic unless -and is added [\#1890](https://github.com/jrnl-org/jrnl/pull/1890) ([eigenric](https://github.com/eigenric))
**Documentation:**
- Recommend pipx as default installation method [\#1888](https://github.com/jrnl-org/jrnl/issues/1888)
- Remove documentation recommendation to install pipx through brew or pip [\#1886](https://github.com/jrnl-org/jrnl/issues/1886)
- Document security risks of using a computer that someone else has admin access to [\#1793](https://github.com/jrnl-org/jrnl/issues/1793)
- Recommend pipx as easiest installation method for all OSes and remove warning about apt [\#1889](https://github.com/jrnl-org/jrnl/pull/1889) ([micahellison](https://github.com/micahellison))
- Docs accessibility checker failure - contrast ratio [\#1934](https://github.com/jrnl-org/jrnl/issues/1934)
- Docs accessibility test runner failing [\#1932](https://github.com/jrnl-org/jrnl/issues/1932)
**Packaging:**
- Update actions/cache action to v4 [\#1847](https://github.com/jrnl-org/jrnl/pull/1847) ([renovate[bot]](https://github.com/apps/renovate))
- Update actions/setup-python action to v5 [\#1848](https://github.com/jrnl-org/jrnl/pull/1848) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency black to v24.8.0 [\#1923](https://github.com/jrnl-org/jrnl/pull/1923) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency cryptography to v43.0.3 [\#1942](https://github.com/jrnl-org/jrnl/pull/1942) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency jinja2 to v3.1.4 [\#1892](https://github.com/jrnl-org/jrnl/pull/1892) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency keyring to v25.4.1 [\#1924](https://github.com/jrnl-org/jrnl/pull/1924) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency mkdocs to v1.6.1 [\#1895](https://github.com/jrnl-org/jrnl/pull/1895) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pa11y-ci to v3.1.0 [\#1831](https://github.com/jrnl-org/jrnl/pull/1831) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency parse-type to v0.6.4 [\#1936](https://github.com/jrnl-org/jrnl/pull/1936) ([renovate[bot]](https://github.com/apps/renovate))
- Update peter-evans/create-pull-request action to v7 [\#1929](https://github.com/jrnl-org/jrnl/pull/1929) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency poethepoet to v0.29.0 [\#1925](https://github.com/jrnl-org/jrnl/pull/1925) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest to v7.4.4 [\#1845](https://github.com/jrnl-org/jrnl/pull/1845) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest-bdd to v7.3.0 [\#1896](https://github.com/jrnl-org/jrnl/pull/1896) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest-xdist to v3.6.1 [\#1897](https://github.com/jrnl-org/jrnl/pull/1897) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency python-dateutil to v2.9.0 [\#1898](https://github.com/jrnl-org/jrnl/pull/1898) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency requests to v2.32.3 [\#1899](https://github.com/jrnl-org/jrnl/pull/1899) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency rich to v13.9.2 [\#1937](https://github.com/jrnl-org/jrnl/pull/1937) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruamel.yaml to v0.18.6 [\#1855](https://github.com/jrnl-org/jrnl/pull/1855) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruff to v0.7.0 [\#1938](https://github.com/jrnl-org/jrnl/pull/1938) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tox to v4.23.0 [\#1935](https://github.com/jrnl-org/jrnl/pull/1935) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency typed.js to v2.1.0 [\#1861](https://github.com/jrnl-org/jrnl/pull/1861) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency xmltodict to v0.14.2 [\#1940](https://github.com/jrnl-org/jrnl/pull/1940) ([renovate[bot]](https://github.com/apps/renovate))
- Update nick-invision/retry action to v3 [\#1851](https://github.com/jrnl-org/jrnl/pull/1851) ([renovate[bot]](https://github.com/apps/renovate))
- Update peter-evans/create-pull-request action to v6 [\#1852](https://github.com/jrnl-org/jrnl/pull/1852) ([renovate[bot]](https://github.com/apps/renovate))
## [v4.1](https://pypi.org/project/jrnl/v4.1/) (2023-11-04)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.1-beta2...v4.1)
**Build:**
- Add Python 3.12 support [\#1761](https://github.com/jrnl-org/jrnl/pull/1761) ([micahellison](https://github.com/micahellison))
- Set new required build fields in the ReadTheDocs config file [\#1803](https://github.com/jrnl-org/jrnl/pull/1803) ([micahellison](https://github.com/micahellison))
- Replace flake8 and isort with ruff linter and add `black --check` to linting step [\#1763](https://github.com/jrnl-org/jrnl/pull/1763) ([micahellison](https://github.com/micahellison))
**Documentation:**
- Add note about messages going to `stderr` and the implication for piping [\#1768](https://github.com/jrnl-org/jrnl/pull/1768) ([micahellison](https://github.com/micahellison))
**Packaging:**
- Drop/replace ansiwrap dependency [\#1191](https://github.com/jrnl-org/jrnl/issues/1191)
- Use rich instead of ansiwrap to wrap text [\#1693](https://github.com/jrnl-org/jrnl/pull/1693) ([micahellison](https://github.com/micahellison))
- Update actions/checkout action to v4 [\#1788](https://github.com/jrnl-org/jrnl/pull/1788) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency black to v23.10.1 [\#1811](https://github.com/jrnl-org/jrnl/pull/1811) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency cryptography to v41.0.5 [\#1815](https://github.com/jrnl-org/jrnl/pull/1815) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency keyring to v24.2.0 [\#1760](https://github.com/jrnl-org/jrnl/pull/1760) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency mkdocs to v1.5.3 [\#1795](https://github.com/jrnl-org/jrnl/pull/1795) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency parse-type to v0.6.2 [\#1762](https://github.com/jrnl-org/jrnl/pull/1762) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency poethepoet to v0.24.1 [\#1806](https://github.com/jrnl-org/jrnl/pull/1806) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest to v7.4.3 [\#1816](https://github.com/jrnl-org/jrnl/pull/1816) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest-bdd to v7 [\#1807](https://github.com/jrnl-org/jrnl/pull/1807) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency rich to v13.6.0 [\#1794](https://github.com/jrnl-org/jrnl/pull/1794) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruamel.yaml to v0.18.3 [\#1813](https://github.com/jrnl-org/jrnl/pull/1813) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruff to v0.1.3 [\#1810](https://github.com/jrnl-org/jrnl/pull/1810) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tox to v4.11.3 [\#1782](https://github.com/jrnl-org/jrnl/pull/1782) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tzlocal to v5.2 [\#1814](https://github.com/jrnl-org/jrnl/pull/1814) ([renovate[bot]](https://github.com/apps/renovate))
**Special thanks:**
- jrnl uses UTC instead of local time for entries in WSL/Ubuntu [\#1607](https://github.com/jrnl-org/jrnl/issues/1607) investigated and reported upstream by [giuseppedandrea](https://github.com/giuseppedandrea)
## [v4.0.1](https://pypi.org/project/jrnl/v4.0.1/) (2023-06-20)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.0.1-beta...v4.0.1)
**Fixed bugs:**
- jrnl crashes when running `jrnl --list --format json` and `jrnl --list --format yaml` [\#1737](https://github.com/jrnl-org/jrnl/issues/1737)
- Refactor --template code [\#1711](https://github.com/jrnl-org/jrnl/pull/1711) ([micahellison](https://github.com/micahellison))
**Build:**
- Fix linting issue in CI pipeline [\#1743](https://github.com/jrnl-org/jrnl/pull/1743) ([wren](https://github.com/wren))
**Packaging:**
- Update dependency ruamel.yaml to v0.17.28 [\#1749](https://github.com/jrnl-org/jrnl/pull/1749) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency requests to v2.31.0 [\#1748](https://github.com/jrnl-org/jrnl/pull/1748) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruamel.yaml to v0.17.26 [\#1746](https://github.com/jrnl-org/jrnl/pull/1746) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tzlocal to v5 [\#1741](https://github.com/jrnl-org/jrnl/pull/1741) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest-xdist to v3.3.1 [\#1740](https://github.com/jrnl-org/jrnl/pull/1740) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency poethepoet to v0.20.0 [\#1735](https://github.com/jrnl-org/jrnl/pull/1735) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency mkdocs to v1.4.3 [\#1733](https://github.com/jrnl-org/jrnl/pull/1733) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency rich to v13.3.5 [\#1729](https://github.com/jrnl-org/jrnl/pull/1729) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency requests to v2.30.0 [\#1728](https://github.com/jrnl-org/jrnl/pull/1728) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tox to v4.5.1 [\#1727](https://github.com/jrnl-org/jrnl/pull/1727) ([renovate[bot]](https://github.com/apps/renovate))
- Update peter-evans/create-pull-request action to v5 [\#1719](https://github.com/jrnl-org/jrnl/pull/1719) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency flake8-simplify to v0.20.0 [\#1716](https://github.com/jrnl-org/jrnl/pull/1716) ([renovate[bot]](https://github.com/apps/renovate))
## [v4.0](https://pypi.org/project/jrnl/v4.0/) (2023-05-20)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.0-beta3...v4.0)
🚨 **BREAKING CHANGES** 🚨
**Deprecated:**
- Drop Python 3.9 and use Python 3.11 official release [\#1611](https://github.com/jrnl-org/jrnl/pull/1611) ([micahellison](https://github.com/micahellison))
**Implemented enhancements:**
- Add message with config location and docs location when installation is complete [\#1695](https://github.com/jrnl-org/jrnl/pull/1695) ([micahellison](https://github.com/micahellison))
- Prompt to include colors in config when first running jrnl [\#1687](https://github.com/jrnl-org/jrnl/pull/1687) ([micahellison](https://github.com/micahellison))
- Add ability to use template with `--template` [\#1667](https://github.com/jrnl-org/jrnl/pull/1667) ([alichtman](https://github.com/alichtman))
- Search for entries with no tags or stars with `-not -starred` and `-not -tagged` [\#1663](https://github.com/jrnl-org/jrnl/pull/1663) ([cjcon90](https://github.com/cjcon90))
- Refactor flow for easier access to some files \(avoid things like `jrnl.Journal.Journal` and `jrnl.jrnl` co-existing\) [\#1662](https://github.com/jrnl-org/jrnl/pull/1662) ([wren](https://github.com/wren))
- Add more type hints [\#1642](https://github.com/jrnl-org/jrnl/pull/1642) ([outa](https://github.com/outa))
- Add `rich` handler to debug logging [\#1627](https://github.com/jrnl-org/jrnl/pull/1627) ([wren](https://github.com/wren))
- Rework Encryption to enable future support of other encryption methods [\#1602](https://github.com/jrnl-org/jrnl/pull/1602) ([wren](https://github.com/wren))
**Fixed bugs:**
- Only read text files that look like entries when opening folder journal [\#1697](https://github.com/jrnl-org/jrnl/pull/1697) ([micahellison](https://github.com/micahellison))
- Save empty journal on install instead of just creating a zero-length file [\#1690](https://github.com/jrnl-org/jrnl/pull/1690) ([micahellison](https://github.com/micahellison))
- Allow combinations of `--change-time`, `--delete`, and `--edit` while correctly counting the number of entries affected [\#1669](https://github.com/jrnl-org/jrnl/pull/1669) ([wren](https://github.com/wren))
- Don't save templated journal entries if the received raw text is the same as the template itself [\#1653](https://github.com/jrnl-org/jrnl/pull/1653) ([Briscoooe](https://github.com/Briscoooe))
- Add tag to XML file when edited DayOne entry and is searchable afterward [\#1648](https://github.com/jrnl-org/jrnl/pull/1648) ([jonakeys](https://github.com/jonakeys))
- Update version key in config file after version changes [\#1646](https://github.com/jrnl-org/jrnl/pull/1646) ([jonakeys](https://github.com/jonakeys))
**Build:**
- Update copyright notices for 2023 [\#1660](https://github.com/jrnl-org/jrnl/pull/1660) ([wren](https://github.com/wren))
- Fix bug where changelog is always slightly out of date on release tags [\#1631](https://github.com/jrnl-org/jrnl/pull/1631) ([wren](https://github.com/wren))
- Add `simplify` plugin to linting checks [\#1630](https://github.com/jrnl-org/jrnl/pull/1630) ([wren](https://github.com/wren))
- Add type hints [\#1614](https://github.com/jrnl-org/jrnl/pull/1614) ([outa](https://github.com/outa))
**Documentation:**
- Update contributing.md links in documentation [\#1726](https://github.com/jrnl-org/jrnl/pull/1726) ([ahosking](https://github.com/ahosking))
- Fix various typos [\#1718](https://github.com/jrnl-org/jrnl/pull/1718) ([hezhizhen](https://github.com/hezhizhen))
- Update documentation front page text [\#1698](https://github.com/jrnl-org/jrnl/pull/1698) ([micahellison](https://github.com/micahellison))
- Support mkdocs 1.4.2 and fix its missing breadcrumb [\#1691](https://github.com/jrnl-org/jrnl/pull/1691) ([micahellison](https://github.com/micahellison))
- Document temporary file extension behavior when using template [\#1686](https://github.com/jrnl-org/jrnl/pull/1686) ([micahellison](https://github.com/micahellison))
- Document `-tagged`, `-not -tagged`, and `-not -starred` [\#1684](https://github.com/jrnl-org/jrnl/pull/1684) ([micahellison](https://github.com/micahellison))
- Update documentation about privacy and security in VSCode [\#1680](https://github.com/jrnl-org/jrnl/pull/1680) ([giuseppedandrea](https://github.com/giuseppedandrea))
- Update documentation on temporary files naming [\#1673](https://github.com/jrnl-org/jrnl/pull/1673) ([giuseppedandrea](https://github.com/giuseppedandrea))
- Update docs to include time and title in arguments with `--edit` [\#1657](https://github.com/jrnl-org/jrnl/pull/1657) ([pconrad-fb](https://github.com/pconrad-fb))
- Fix markup in "Advanced Usage" doc [\#1655](https://github.com/jrnl-org/jrnl/pull/1655) ([multani](https://github.com/multani))
- Remove Windows 7 known issue since Windows 7 is no longer supported [\#1636](https://github.com/jrnl-org/jrnl/pull/1636) ([micahellison](https://github.com/micahellison))
**Packaging:**
- Lock ruamel.yaml version to v0.17.21 until bug is fixed [\#1738](https://github.com/jrnl-org/jrnl/pull/1738) ([wren](https://github.com/wren))
- Update dependency black to v23.3.0 [\#1715](https://github.com/jrnl-org/jrnl/pull/1715) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency cryptography to v40.0.2 [\#1723](https://github.com/jrnl-org/jrnl/pull/1723) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency flake8-type-checking to v2.4.0 [\#1714](https://github.com/jrnl-org/jrnl/pull/1714) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency flakeheaven to v3.3.0 [\#1722](https://github.com/jrnl-org/jrnl/pull/1722) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ipdb to v0.13.13 [\#1703](https://github.com/jrnl-org/jrnl/pull/1703) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency poethepoet to v0.19.0 [\#1709](https://github.com/jrnl-org/jrnl/pull/1709) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest to v7.3.1 [\#1720](https://github.com/jrnl-org/jrnl/pull/1720) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest-xdist to v3.2.1 [\#1705](https://github.com/jrnl-org/jrnl/pull/1705) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency rich to v13.3.4 [\#1713](https://github.com/jrnl-org/jrnl/pull/1713) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tox to v4.4.7 [\#1707](https://github.com/jrnl-org/jrnl/pull/1707) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tzlocal to v4.3 [\#1708](https://github.com/jrnl-org/jrnl/pull/1708) ([renovate[bot]](https://github.com/apps/renovate))
## [v3.3](https://pypi.org/project/jrnl/v3.3/) (2022-10-29)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta2...v3.3)
**Implemented enhancements:**
- Change default config to use journal key [\#1594](https://github.com/jrnl-org/jrnl/pull/1594) ([micahellison](https://github.com/micahellison))
- Add machine readable --list output [\#1592](https://github.com/jrnl-org/jrnl/pull/1592) ([apainintheneck](https://github.com/apainintheneck))
**Fixed bugs:**
- Fix bug for new `--list --format` options when no default journal is specified [\#1621](https://github.com/jrnl-org/jrnl/pull/1621) ([wren](https://github.com/wren))
- Don't create empty file when attempting a YAML export to a non-existing folder [\#1600](https://github.com/jrnl-org/jrnl/pull/1600) ([outa](https://github.com/outa))
**Build:**
- Update `.gitignore` [\#1604](https://github.com/jrnl-org/jrnl/pull/1604) ([wren](https://github.com/wren))
- Fix Docs Accessibility Testing [\#1588](https://github.com/jrnl-org/jrnl/pull/1588) ([wren](https://github.com/wren))
- Update to use renamed flag for `brew bump-formula-pr` [\#1587](https://github.com/jrnl-org/jrnl/pull/1587) ([wren](https://github.com/wren))
- Update peter-evans/create-pull-request action to v4 [\#1585](https://github.com/jrnl-org/jrnl/pull/1585) ([renovate[bot]](https://github.com/apps/renovate))
- Update actions/setup-python action to v4 [\#1583](https://github.com/jrnl-org/jrnl/pull/1583) ([renovate[bot]](https://github.com/apps/renovate))
- Update actions/checkout action to v3 [\#1582](https://github.com/jrnl-org/jrnl/pull/1582) ([renovate[bot]](https://github.com/apps/renovate))
- Update actions/cache action to v3 [\#1581](https://github.com/jrnl-org/jrnl/pull/1581) ([renovate[bot]](https://github.com/apps/renovate))
- Replace Dependabot with Renovate [\#1575](https://github.com/jrnl-org/jrnl/pull/1575) ([renovate[bot]](https://github.com/apps/renovate))
**Documentation:**
- Add documentation about how the editor must be a blocking process [\#1456](https://github.com/jrnl-org/jrnl/issues/1456)
- Document that editors must be blocking processes [\#1624](https://github.com/jrnl-org/jrnl/pull/1624) ([micahellison](https://github.com/micahellison))
- Remove wrong option in configuration file reference [\#1618](https://github.com/jrnl-org/jrnl/pull/1618) ([DSiekmeier](https://github.com/DSiekmeier))
- Update YAML export description in docs [\#1591](https://github.com/jrnl-org/jrnl/pull/1591) ([apainintheneck](https://github.com/apainintheneck))
- Update dependency jinja2 to v3.1.2 [\#1579](https://github.com/jrnl-org/jrnl/pull/1579) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency typed.js to v2.0.12 [\#1578](https://github.com/jrnl-org/jrnl/pull/1578) ([renovate[bot]](https://github.com/apps/renovate))
- Add hint for how to get vi to go to end-of-file [\#1563](https://github.com/jrnl-org/jrnl/pull/1563) ([pjz](https://github.com/pjz))
**Packaging:**
- Pin dependencies [\#1577](https://github.com/jrnl-org/jrnl/pull/1577) ([renovate[bot]](https://github.com/apps/renovate))
## [v3.2](https://pypi.org/project/jrnl/v3.2/) (2022-09-03)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.2-beta...v3.2)
**Implemented enhancements:**
- Update issue & PR templates to use forms [\#1559](https://github.com/jrnl-org/jrnl/issues/1559)
- Suppress "Entry added" message if using default journal [\#1561](https://github.com/jrnl-org/jrnl/pull/1561) ([micahellison](https://github.com/micahellison))
- Add message showing the number of search results [\#1524](https://github.com/jrnl-org/jrnl/pull/1524) ([apainintheneck](https://github.com/apainintheneck))
**Build:**
- Quick fix follow up for actionlint [\#1565](https://github.com/jrnl-org/jrnl/pull/1565) ([wren](https://github.com/wren))
**Documentation:**
- Remove note in contributing docs about gh-pages branch that we no longer use [\#1566](https://github.com/jrnl-org/jrnl/pull/1566) ([micahellison](https://github.com/micahellison))
## [v3.1](https://pypi.org/project/jrnl/v3.1/) (2022-08-21)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.1-beta2...v3.1)
**Implemented enhancements:**
- Update tzlocal to v4.x and remove pytz dependency [\#1528](https://github.com/jrnl-org/jrnl/pull/1528) ([outa](https://github.com/outa))
- Add linewrap option 'auto' [\#1507](https://github.com/jrnl-org/jrnl/pull/1507) ([jonakeys](https://github.com/jonakeys))
**Fixed bugs:**
- Update formatting function to better account for indentation [\#1541](https://github.com/jrnl-org/jrnl/pull/1541) ([wren](https://github.com/wren))
- Export to file\(s\) when first line/title of an entry is very long [\#1527](https://github.com/jrnl-org/jrnl/pull/1527) ([jonakeys](https://github.com/jonakeys))
- Fixed index out of range error in fancy exporter [\#1522](https://github.com/jrnl-org/jrnl/pull/1522) ([apainintheneck](https://github.com/apainintheneck))
**Build:**
- Add actionlint to testing pipelines [\#1555](https://github.com/jrnl-org/jrnl/pull/1555) ([wren](https://github.com/wren))
- Fix docs pipeline, make docs tests easier to run locally and on different OSes [\#1554](https://github.com/jrnl-org/jrnl/pull/1554) ([wren](https://github.com/wren))
**Documentation:**
- Reformat contributor appreciation on `--help` screen [\#1556](https://github.com/jrnl-org/jrnl/pull/1556) ([xeruf](https://github.com/xeruf))
- Clean up copyright notices and version screen [\#1553](https://github.com/jrnl-org/jrnl/pull/1553) ([wren](https://github.com/wren))
**Packaging:**
- Bump pyproject-flake8 from 0.0.1a4 to 0.0.1a5 [\#1552](https://github.com/jrnl-org/jrnl/pull/1552) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 23.7.0 to 23.8.2 [\#1551](https://github.com/jrnl-org/jrnl/pull/1551) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump yq from 3.0.2 to 3.1.0 [\#1546](https://github.com/jrnl-org/jrnl/pull/1546) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump poethepoet from 0.15.0 to 0.16.0 [\#1542](https://github.com/jrnl-org/jrnl/pull/1542) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 23.6.0 to 23.7.0 [\#1539](https://github.com/jrnl-org/jrnl/pull/1539) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump rich from 12.4.4 to 12.5.1 [\#1538](https://github.com/jrnl-org/jrnl/pull/1538) ([dependabot[bot]](https://github.com/apps/dependabot))
## [v3.0](https://pypi.org/project/jrnl/v3.0/) (2022-07-09)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.0-beta2...v3.0)
🚨 **BREAKING CHANGES** 🚨
**Deprecated:**
- Drop support for Python 3.7 and 3.8 [\#1412](https://github.com/jrnl-org/jrnl/pull/1412) ([micahellison](https://github.com/micahellison))
**Implemented enhancements:**
- Show name of journal when creating a password/encrypting [\#1478](https://github.com/jrnl-org/jrnl/pull/1478) ([jonakeys](https://github.com/jonakeys))
- Rework how all output and messaging works in jrnl [\#1475](https://github.com/jrnl-org/jrnl/pull/1475) ([wren](https://github.com/wren))
- Implement --change-time flag [\#1452](https://github.com/jrnl-org/jrnl/pull/1452) ([richardjs](https://github.com/richardjs))
- Reformat additional messages and finish centralizing exception handling [\#1424](https://github.com/jrnl-org/jrnl/pull/1424) ([wren](https://github.com/wren))
- Reformat messages and add new centralized exception handling [\#1417](https://github.com/jrnl-org/jrnl/pull/1417) ([wren](https://github.com/wren))
**Fixed bugs:**
- Display message when no edits take place [\#1510](https://github.com/jrnl-org/jrnl/pull/1510) ([apainintheneck](https://github.com/apainintheneck))
- Fixed error related to display\_format in config file for some values [\#1495](https://github.com/jrnl-org/jrnl/pull/1495) ([apainintheneck](https://github.com/apainintheneck))
- Create folder if config ends with \(back\)slash [\#1492](https://github.com/jrnl-org/jrnl/pull/1492) ([jonakeys](https://github.com/jonakeys))
- `-not` search parameter no longer opens editor [\#1490](https://github.com/jrnl-org/jrnl/pull/1490) ([apainintheneck](https://github.com/apainintheneck))
- Fix TypeError when using debug flag [\#1484](https://github.com/jrnl-org/jrnl/pull/1484) ([jonakeys](https://github.com/jonakeys))
- Prompt for password change when using 'jrnl --encrypt' on already encrypted journal [\#1477](https://github.com/jrnl-org/jrnl/pull/1477) ([jonakeys](https://github.com/jonakeys))
- Always expand all paths \(journals, templates, etc\) [\#1468](https://github.com/jrnl-org/jrnl/pull/1468) ([apainintheneck](https://github.com/apainintheneck))
- The `-not` option with no arguments now outputs error instead of stack trace [\#1466](https://github.com/jrnl-org/jrnl/pull/1466) ([apainintheneck](https://github.com/apainintheneck))
- Give a proper message when trying to use an empty config file [\#1461](https://github.com/jrnl-org/jrnl/pull/1461) ([jonakeys](https://github.com/jonakeys))
- Display "No entry to save, because no text was received" after empty entry on cmdline [\#1459](https://github.com/jrnl-org/jrnl/pull/1459) ([apainintheneck](https://github.com/apainintheneck))
- Yaml export errors now don't show stack trace [\#1449](https://github.com/jrnl-org/jrnl/pull/1449) ([apainintheneck](https://github.com/apainintheneck))
**Build:**
- Pin `pytest-bdd` to \<6.0 to temporarily avoid breaking changes [\#1536](https://github.com/jrnl-org/jrnl/pull/1536) ([wren](https://github.com/wren))
- Reduce difference between local and CI environments [\#1518](https://github.com/jrnl-org/jrnl/pull/1518) ([wren](https://github.com/wren))
- Add bdd tests for jrnl installation [\#1513](https://github.com/jrnl-org/jrnl/pull/1513) ([apainintheneck](https://github.com/apainintheneck))
- Stop hardcoding bot info in changelog pipeline [\#1506](https://github.com/jrnl-org/jrnl/pull/1506) ([wren](https://github.com/wren))
- Fix Poetry caching for accessibility tests [\#1505](https://github.com/jrnl-org/jrnl/pull/1505) ([wren](https://github.com/wren))
- Implement Tox for testing [\#1504](https://github.com/jrnl-org/jrnl/pull/1504) ([wren](https://github.com/wren))
- Replace `make` with python alternative \(`poe`\) [\#1503](https://github.com/jrnl-org/jrnl/pull/1503) ([wren](https://github.com/wren))
- Update copyright year [\#1502](https://github.com/jrnl-org/jrnl/pull/1502) ([wren](https://github.com/wren))
- Add Python 3.11 to PR tests [\#1500](https://github.com/jrnl-org/jrnl/pull/1500) ([micahellison](https://github.com/micahellison))
- Pin jinja2 in docs requirements to keep readthedocs builds from failing [\#1439](https://github.com/jrnl-org/jrnl/pull/1439) ([micahellison](https://github.com/micahellison))
- Tidy up git ignore [\#1414](https://github.com/jrnl-org/jrnl/pull/1414) ([nelnog](https://github.com/nelnog))
**Documentation:**
- Document --change-time in web-based docs' command line reference [\#1471](https://github.com/jrnl-org/jrnl/pull/1471) ([micahellison](https://github.com/micahellison))
**Packaging:**
- Bump cryptography from 37.0.2 to 37.0.3 [\#1516](https://github.com/jrnl-org/jrnl/pull/1516) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump poethepoet from 0.13.1 to 0.14.0 [\#1514](https://github.com/jrnl-org/jrnl/pull/1514) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 23.5.1 to 23.6.0 [\#1499](https://github.com/jrnl-org/jrnl/pull/1499) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pyxdg from 0.27 to 0.28 [\#1497](https://github.com/jrnl-org/jrnl/pull/1497) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 23.5.0 to 23.5.1 [\#1487](https://github.com/jrnl-org/jrnl/pull/1487) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump cryptography from 37.0.1 to 37.0.2 [\#1467](https://github.com/jrnl-org/jrnl/pull/1467) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump cryptography from 36.0.2 to 37.0.1 [\#1462](https://github.com/jrnl-org/jrnl/pull/1462) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytest from 7.1.1 to 7.1.2 [\#1458](https://github.com/jrnl-org/jrnl/pull/1458) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pyproject-flake8 from 0.0.1a3 to 0.0.1a4 [\#1447](https://github.com/jrnl-org/jrnl/pull/1447) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump black from 22.1.0 to 22.3.0 [\#1442](https://github.com/jrnl-org/jrnl/pull/1442) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump mkdocs from 1.2.3 to 1.3.0 [\#1441](https://github.com/jrnl-org/jrnl/pull/1441) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pyproject-flake8 from 0.0.1a2 to 0.0.1a3 [\#1440](https://github.com/jrnl-org/jrnl/pull/1440) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytz from 2021.3 to 2022.1 [\#1438](https://github.com/jrnl-org/jrnl/pull/1438) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytest from 7.0.1 to 7.1.1 [\#1430](https://github.com/jrnl-org/jrnl/pull/1430) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump cryptography from 36.0.1 to 36.0.2 [\#1427](https://github.com/jrnl-org/jrnl/pull/1427) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump yq from 2.13.0 to 2.14.0 [\#1418](https://github.com/jrnl-org/jrnl/pull/1418) ([dependabot[bot]](https://github.com/apps/dependabot))
- Replace PyYAML with ruamel.yaml [\#1416](https://github.com/jrnl-org/jrnl/pull/1416) ([micahellison](https://github.com/micahellison))
- Bump pytest from 6.2.5 to 7.0.0 [\#1407](https://github.com/jrnl-org/jrnl/pull/1407) ([dependabot[bot]](https://github.com/apps/dependabot))
## [v2.8.4](https://pypi.org/project/jrnl/v2.8.4/) (2022-02-12)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.8.4-beta2...v2.8.4)
**Implemented enhancements:**
- Add hash as a default tag symbol for new jrnl config file [\#1398](https://github.com/jrnl-org/jrnl/pull/1398) ([micahellison](https://github.com/micahellison))
- Add --config-file argument to use alternate config file at runtime [\#1290](https://github.com/jrnl-org/jrnl/pull/1290) ([samuelgregorovic](https://github.com/samuelgregorovic))
**Fixed bugs:**
- Certs broken on website [\#1408](https://github.com/jrnl-org/jrnl/issues/1408)
- Add added option to \_print\_edited\_summary [\#1366](https://github.com/jrnl-org/jrnl/pull/1366) ([piero-vic](https://github.com/piero-vic))
**Build:**
- Improve handling of mocking logic in pytest [\#1382](https://github.com/jrnl-org/jrnl/pull/1382) ([wren](https://github.com/wren))
- Use full Python version for GitHub Actions cache key [\#1373](https://github.com/jrnl-org/jrnl/pull/1373) ([micahellison](https://github.com/micahellison))
- Use Python 3.10 stable in CI [\#1362](https://github.com/jrnl-org/jrnl/pull/1362) ([micahellison](https://github.com/micahellison))
- Switch from poetry to poetry-core [\#1359](https://github.com/jrnl-org/jrnl/pull/1359) ([fabaff](https://github.com/fabaff))
- Add more steps to `pytest`, fully remove `behave` [\#1347](https://github.com/jrnl-org/jrnl/pull/1347) ([wren](https://github.com/wren))
**Documentation:**
- Fix styling on documentation sidebar [\#1395](https://github.com/jrnl-org/jrnl/pull/1395) ([wren](https://github.com/wren))
- Added Recipe for visualizing Markdown in the CLI [\#1354](https://github.com/jrnl-org/jrnl/pull/1354) ([viegasfh](https://github.com/viegasfh))
- Fix recipe 'Launch a terminal for rapid logging' [\#1351](https://github.com/jrnl-org/jrnl/pull/1351) ([zapateo](https://github.com/zapateo))
- Fix readme splash and add changelog link to readme [\#1339](https://github.com/jrnl-org/jrnl/pull/1339) ([micahellison](https://github.com/micahellison))
- Add reference documentation to docs site and separate out "Tips and Tricks" and "External Editors" from "Recipes" [\#1332](https://github.com/jrnl-org/jrnl/pull/1332) ([micahellison](https://github.com/micahellison))
- Document journal types [\#1331](https://github.com/jrnl-org/jrnl/pull/1331) ([micahellison](https://github.com/micahellison))
**Packaging:**
- Bump asteval from 0.9.25 to 0.9.26 [\#1400](https://github.com/jrnl-org/jrnl/pull/1400) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump black from 21.7b0 to 22.1.0 [\#1404](https://github.com/jrnl-org/jrnl/pull/1404) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump cryptography from 3.4.8 to 36.0.1 [\#1389](https://github.com/jrnl-org/jrnl/pull/1389) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump ipython from 7.28.0 to 7.31.1 [\#1401](https://github.com/jrnl-org/jrnl/pull/1401) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 23.1.0 to 23.5.0 [\#1392](https://github.com/jrnl-org/jrnl/pull/1392) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump mkdocs from 1.2.2 to 1.2.3 [\#1355](https://github.com/jrnl-org/jrnl/pull/1355) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytest from 6.2.4 to 6.2.5 [\#1334](https://github.com/jrnl-org/jrnl/pull/1334) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytest-bdd from 4.1.0 to 5.0.0 [\#1368](https://github.com/jrnl-org/jrnl/pull/1368) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytz from 2021.1 to 2021.3 [\#1348](https://github.com/jrnl-org/jrnl/pull/1348) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump yq from 2.12.2 to 2.13.0 [\#1385](https://github.com/jrnl-org/jrnl/pull/1385) ([dependabot[bot]](https://github.com/apps/dependabot))
## [v2.8.3](https://pypi.org/project/jrnl/v2.8.3/) (2021-09-06)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.8.3-beta...v2.8.3)
**Fixed bugs:**
- Fix deletion of entries on folder journal through `--delete` flag [\#1328](https://github.com/jrnl-org/jrnl/pull/1328) ([micahellison](https://github.com/micahellison))
- Warn when DayOne/directory journals have encrypt: true in config [\#1325](https://github.com/jrnl-org/jrnl/pull/1325) ([micahellison](https://github.com/micahellison))
- Fix failure to import into directory journal [\#1314](https://github.com/jrnl-org/jrnl/pull/1314) ([micahellison](https://github.com/micahellison))
- Allow emoji in config file in Windows by always opening it as unicode [\#1313](https://github.com/jrnl-org/jrnl/pull/1313) ([micahellison](https://github.com/micahellison))
**Build:**
- Set bash as default shell [\#1324](https://github.com/jrnl-org/jrnl/pull/1324) ([micahellison](https://github.com/micahellison))
**Packaging:**
- Bump cryptography from 3.4.7 to 3.4.8 [\#1329](https://github.com/jrnl-org/jrnl/pull/1329) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 23.0.1 to 23.1.0 [\#1318](https://github.com/jrnl-org/jrnl/pull/1318) ([dependabot[bot]](https://github.com/apps/dependabot))
## [v2.8.2](https://pypi.org/project/jrnl/v2.8.2/) (2021-07-31)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.8.2-beta...v2.8.2)
**Build:**
- Add CI tests for latest dev Python build [\#1273](https://github.com/jrnl-org/jrnl/issues/1273)
- Fix lock file from stable Poetry version [\#1298](https://github.com/jrnl-org/jrnl/pull/1298) ([wren](https://github.com/wren))
- Change all YAML FullLoader calls to SafeLoader [\#1285](https://github.com/jrnl-org/jrnl/pull/1285) ([micahellison](https://github.com/micahellison))
- Remove useless shebangs and executable permissions [\#1283](https://github.com/jrnl-org/jrnl/pull/1283) ([musicinmybrain](https://github.com/musicinmybrain))
- Add Python 3.10 support [\#1271](https://github.com/jrnl-org/jrnl/pull/1271) ([micahellison](https://github.com/micahellison))
- Ensure that line endings in all py files are Linux style instead of Windows [\#1250](https://github.com/jrnl-org/jrnl/pull/1250) ([micahellison](https://github.com/micahellison))
- Remove `--version` from brew release workflow [\#1233](https://github.com/jrnl-org/jrnl/pull/1233) ([wren](https://github.com/wren))
- Move test suite to Pytest \(replace Behave\) [\#1193](https://github.com/jrnl-org/jrnl/pull/1193) ([wren](https://github.com/wren))
**Documentation:**
- Add documentation about saved passwords in Windows [\#1301](https://github.com/jrnl-org/jrnl/pull/1301) ([micahellison](https://github.com/micahellison))
- Add security.md [\#1299](https://github.com/jrnl-org/jrnl/pull/1299) ([micahellison](https://github.com/micahellison))
**Packaging:**
- Bump mkdocs from 1.2.1 to 1.2.2 [\#1307](https://github.com/jrnl-org/jrnl/pull/1307) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump python-dateutil from 2.8.1 to 2.8.2 [\#1302](https://github.com/jrnl-org/jrnl/pull/1302) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump black from 21.5b1 to 21.5b2 [\#1254](https://github.com/jrnl-org/jrnl/pull/1254) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump black from 21.5b0 to 21.5b1 [\#1244](https://github.com/jrnl-org/jrnl/pull/1244) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump black from 20.8b1 to 21.5b0 [\#1241](https://github.com/jrnl-org/jrnl/pull/1241) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytest from 6.2.3 to 6.2.4 [\#1240](https://github.com/jrnl-org/jrnl/pull/1240) ([dependabot[bot]](https://github.com/apps/dependabot))
## [v2.8.1](https://pypi.org/project/jrnl/v2.8.1/) (2021-04-24)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.8.1-beta...v2.8.1)
**Fixed bugs:**
- More graceful handling of low linewrap values [\#1219](https://github.com/jrnl-org/jrnl/pull/1219) ([sriniv27](https://github.com/sriniv27))
**Documentation:**
- Update absolute URLs to preview images in metatags [\#1229](https://github.com/jrnl-org/jrnl/pull/1229) ([maebert](https://github.com/maebert))
- Docs: Add emacs as external editor to recipes [\#1220](https://github.com/jrnl-org/jrnl/pull/1220) ([mandarvaze](https://github.com/mandarvaze))
**Packaging:**
- Bump pytest from 6.2.2 to 6.2.3 [\#1228](https://github.com/jrnl-org/jrnl/pull/1228) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump cryptography from 3.4.6 to 3.4.7 [\#1223](https://github.com/jrnl-org/jrnl/pull/1223) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 23.0.0 to 23.0.1 [\#1222](https://github.com/jrnl-org/jrnl/pull/1222) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pyflakes from 2.3.0 to 2.3.1 [\#1221](https://github.com/jrnl-org/jrnl/pull/1221) ([dependabot[bot]](https://github.com/apps/dependabot))
## [v2.8](https://pypi.org/project/jrnl/v2.8/) (2021-03-27)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.8-beta...v2.8)
**Implemented enhancements:**
- Add `--config-override` feature [\#1169](https://github.com/jrnl-org/jrnl/pull/1169) ([sriniv27](https://github.com/sriniv27))
**Fixed bugs:**
- Fix bug that prevented --format pretty and --format short from working [\#1177](https://github.com/jrnl-org/jrnl/pull/1177) ([sriniv27](https://github.com/sriniv27))
**Build:**
- Fix broken brew release process [\#1211](https://github.com/jrnl-org/jrnl/pull/1211) ([micahellison](https://github.com/micahellison))
**Packaging:**
- Bump pyflakes from 2.2.0 to 2.3.0 [\#1215](https://github.com/jrnl-org/jrnl/pull/1215) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 22.3.0 to 23.0.0 [\#1213](https://github.com/jrnl-org/jrnl/pull/1213) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 22.0.1 to 22.3.0 [\#1210](https://github.com/jrnl-org/jrnl/pull/1210) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump asteval from 0.9.22 to 0.9.23 [\#1209](https://github.com/jrnl-org/jrnl/pull/1209) ([dependabot[bot]](https://github.com/apps/dependabot))
## [v2.7.1](https://pypi.org/project/jrnl/v2.7.1/) (2021-02-27)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7...v2.7.1)
**Fixed bugs:**
- Make journal selection behavior more consistent when there's a colon with no date [\#1164](https://github.com/jrnl-org/jrnl/pull/1164) ([wren](https://github.com/wren))
**Documentation:**
- Update documentation about journal-level config values [\#1196](https://github.com/jrnl-org/jrnl/issues/1196)
- update per-journal config documentation [\#1199](https://github.com/jrnl-org/jrnl/pull/1199) ([sriniv27](https://github.com/sriniv27))
**Packaging:**
- Bump cryptography from 3.4.4 to 3.4.6 [\#1195](https://github.com/jrnl-org/jrnl/pull/1195) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump asteval from 0.9.21 to 0.9.22 [\#1189](https://github.com/jrnl-org/jrnl/pull/1189) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump cryptography from 3.3.1 to 3.4.4 [\#1188](https://github.com/jrnl-org/jrnl/pull/1188) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump yq from 2.11.1 to 2.12.0 [\#1186](https://github.com/jrnl-org/jrnl/pull/1186) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytz from 2020.5 to 2021.1 [\#1174](https://github.com/jrnl-org/jrnl/pull/1174) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 21.8.0 to 22.0.1 [\#1168](https://github.com/jrnl-org/jrnl/pull/1168) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytest from 6.2.1 to 6.2.2 [\#1167](https://github.com/jrnl-org/jrnl/pull/1167) ([dependabot[bot]](https://github.com/apps/dependabot))
## [v2.7](https://pypi.org/project/jrnl/v2.7/) (2021-01-23)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7-beta...v2.7)
**Implemented enhancements:** **Implemented enhancements:**
- Filter for entries from the same date in previous years [\#1143](https://github.com/jrnl-org/jrnl/issues/1143)
- Implement dependency tracker/updater [\#1120](https://github.com/jrnl-org/jrnl/issues/1120)
- Automate Arch deployment [\#1112](https://github.com/jrnl-org/jrnl/issues/1112)
- Change temporary file names for better text editor integration [\#1080](https://github.com/jrnl-org/jrnl/issues/1080)
- Allow custom file extension for `jrnl --edit` command [\#1059](https://github.com/jrnl-org/jrnl/issues/1059)
- Add new date format \(`--format date`\) for heatmapping [\#1146](https://github.com/jrnl-org/jrnl/pull/1146) ([KarimPwnz](https://github.com/KarimPwnz)) - Add new date format \(`--format date`\) for heatmapping [\#1146](https://github.com/jrnl-org/jrnl/pull/1146) ([KarimPwnz](https://github.com/KarimPwnz))
- Add new `-today-in-history`, `-month`, `-day`, and `-year` search filters [\#1145](https://github.com/jrnl-org/jrnl/pull/1145) ([KarimPwnz](https://github.com/KarimPwnz)) - Add new `-today-in-history`, `-month`, `-day`, and `-year` search filters [\#1145](https://github.com/jrnl-org/jrnl/pull/1145) ([KarimPwnz](https://github.com/KarimPwnz))
- Allow custom extensions when editing \(for easier syntax highlighting\) [\#1139](https://github.com/jrnl-org/jrnl/pull/1139) ([KarimPwnz](https://github.com/KarimPwnz)) - Allow custom extensions when editing \(for easier syntax highlighting\) [\#1139](https://github.com/jrnl-org/jrnl/pull/1139) ([KarimPwnz](https://github.com/KarimPwnz))
**Fixed bugs:** **Fixed bugs:**
- `shlex.split` usage for editor config with commands that have spaces [\#1151](https://github.com/jrnl-org/jrnl/issues/1151) - Editor can't be launched on Windows when using full path to editor executable [\#1096](https://github.com/jrnl-org/jrnl/issues/1096)
- YAML Export lacking delimiters [\#1065](https://github.com/jrnl-org/jrnl/issues/1065)
- Error if password exists in keyring, but retrieval fails for any reason [\#1020](https://github.com/jrnl-org/jrnl/issues/1020)
- Fix OS compatibility issues for editors with spaces, slashes, and quotes [\#1153](https://github.com/jrnl-org/jrnl/pull/1153) ([micahellison](https://github.com/micahellison)) - Fix OS compatibility issues for editors with spaces, slashes, and quotes [\#1153](https://github.com/jrnl-org/jrnl/pull/1153) ([micahellison](https://github.com/micahellison))
- Add delimiters in YAML format [\#1150](https://github.com/jrnl-org/jrnl/pull/1150) ([Seopril](https://github.com/Seopril)) - Add delimiters in YAML format [\#1150](https://github.com/jrnl-org/jrnl/pull/1150) ([Seopril](https://github.com/Seopril))
- Fix keyring error handling [\#1138](https://github.com/jrnl-org/jrnl/pull/1138) ([KarimPwnz](https://github.com/KarimPwnz)) - Fix keyring error handling [\#1138](https://github.com/jrnl-org/jrnl/pull/1138) ([KarimPwnz](https://github.com/KarimPwnz))
@ -48,11 +570,13 @@
**Build:** **Build:**
- Fix homebrew release, add options for release pipeline [\#1154](https://github.com/jrnl-org/jrnl/pull/1154) ([wren](https://github.com/wren))
- Fix changelog generator [\#1127](https://github.com/jrnl-org/jrnl/pull/1127) ([wren](https://github.com/wren)) - Fix changelog generator [\#1127](https://github.com/jrnl-org/jrnl/pull/1127) ([wren](https://github.com/wren))
**Documentation:** **Documentation:**
- Clarify installation docs [\#1097](https://github.com/jrnl-org/jrnl/issues/1097) - add instructions to add VSCode as an external editor for Windows [\#1155](https://github.com/jrnl-org/jrnl/issues/1155)
- Clarify editor documentation for PATH variable and VS Code [\#1160](https://github.com/jrnl-org/jrnl/pull/1160) ([micahellison](https://github.com/micahellison))
- Emphasize installing dependencies before testing [\#1148](https://github.com/jrnl-org/jrnl/pull/1148) ([gumatias](https://github.com/gumatias)) - Emphasize installing dependencies before testing [\#1148](https://github.com/jrnl-org/jrnl/pull/1148) ([gumatias](https://github.com/gumatias))
- Clarify installation documentation \(\#1097\) [\#1137](https://github.com/jrnl-org/jrnl/pull/1137) ([Seopril](https://github.com/Seopril)) - Clarify installation documentation \(\#1097\) [\#1137](https://github.com/jrnl-org/jrnl/pull/1137) ([Seopril](https://github.com/Seopril))
- Fix broken search bar in docs site [\#1135](https://github.com/jrnl-org/jrnl/pull/1135) ([wren](https://github.com/wren)) - Fix broken search bar in docs site [\#1135](https://github.com/jrnl-org/jrnl/pull/1135) ([wren](https://github.com/wren))
@ -62,6 +586,7 @@
**Packaging:** **Packaging:**
- Bump pyyaml from 5.3.1 to 5.4.1 [\#1158](https://github.com/jrnl-org/jrnl/pull/1158) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump keyring from 21.7.0 to 21.8.0 [\#1136](https://github.com/jrnl-org/jrnl/pull/1136) ([dependabot[bot]](https://github.com/apps/dependabot)) - Bump keyring from 21.7.0 to 21.8.0 [\#1136](https://github.com/jrnl-org/jrnl/pull/1136) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump pytz from 2020.4 to 2020.5 [\#1130](https://github.com/jrnl-org/jrnl/pull/1130) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) - Bump pytz from 2020.4 to 2020.5 [\#1130](https://github.com/jrnl-org/jrnl/pull/1130) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
- Bump pytest from 6.2.0 to 6.2.1 [\#1129](https://github.com/jrnl-org/jrnl/pull/1129) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) - Bump pytest from 6.2.0 to 6.2.1 [\#1129](https://github.com/jrnl-org/jrnl/pull/1129) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))

View file

@ -59,7 +59,7 @@ representative at an online or offline event.
## Enforcement ## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by [emailing the maintainers](mailto:jrnl-sh@googlegroups.com). reported by [emailing the maintainers](mailto:maintainers@jrnl.sh).
All complaints will be reviewed and investigated promptly and fairly. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the All community leaders are obligated to respect the privacy and security of the

View file

@ -1,126 +1,8 @@
<!-- Copyright (C) 2012-2021 jrnl contributors <!--
License: https://www.gnu.org/licenses/gpl-3.0.html --> Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Contributing # Contributing
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. See "[Contributing](docs/contributing.md)" in the `docs` directory.
## 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](#developing)
## Code of Conduct
Before starting, please read the [Code of Conduct](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.
To edit the documentation, edit the `docs/*.md` files on the **develop** branch. You can see the result if you run `make html` (or `poetry run mkdocs serve` if on Windows) inside the project's root directory, then navigating your browser to [localhost:8000](http://localhost:8000).
The `gh-pages` branch is automatically maintained and generated after your changes are merged. You should never have to edit that branch.
### Recipes and external editors
If you'd like to share a jrnl command line trick that you find useful, or advice on how to integrate a particular external editor, you may find it worthwhile to add it to the ["Recipes" section](docs/recipes.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](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. To us, that means:
* be _slim_
* have a simple interface
* avoid duplicating functionality
## Developing
### Getting your environment set up
You will need to install [poetry](https://poetry.eustace.io/) 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 `makefile`. \*nix users can run the commands by typing `make` followed by the name of the command; however, Windows users will need to type out the commands directly, or install a third-party make tool such as [GNU Make for Windows](http://gnuwin32.sourceforge.net/packages/make.htm).
A typical development workflow includes:
* Installing dependencies: `poetry install`
* Running tests: `make test`
* Running the source in a virtual environment:
* `poetry shell`
* `jrnl` (with or without arguments as necessary)
* Linting the code to standardize its style: `make lint`
### 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 integration testing, jrnl uses [behave](https://behave.readthedocs.io/) tests, which are all in the `features` 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 `features/steps` which are then executed by your tests in the `feature` files.
Starting in 2020, jrnl is also using [pytest](https://docs.pytest.org/) for unit tests. These tests are in the `tests` folder.
### 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:
* [critical](https://github.com/jrnl-org/jrnl/labels/critical)
* [help wanted](https://github.com/jrnl-org/jrnl/labels/help%20wanted)
* [bug](https://github.com/jrnl-org/jrnl/labels/bug)
* [enhancement](https://github.com/jrnl-org/jrnl/labels/enhancement)
### 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!

View file

@ -1,32 +0,0 @@
# A Makefile for commands I run frequently:
clean:
rm -rf dist
rm -rf _static
rm -rf jrnl.egg-info
rm -rf _build
rm -rf _sources
rm -rf _static
rm -rf site/
rm -f *.html
html:
poetry run mkdocs serve
format: ## Format files to match style
poetry run black .
lint: ## Check style with various tools
poetry check
poetry run pyflakes .
poetry run black --check --diff .
test: lint ## Run unit tests and behave tests
poetry run pytest
poetry run behave --no-skipped --format progress2
build:
poetry build
install: clean ## install the package to the active Python's site-packages
poetry install

View file

@ -1,6 +1,11 @@
<!--
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
<p align="center"> <p align="center">
<a href="https://jrnl.sh"> <a href="https://jrnl.sh">
<img align="center" src="https://github.com/jrnl-org/jrnl/blob/develop/docs_theme/assets/readme-header.png"/> <img align="center" src="https://raw.githubusercontent.com/jrnl-org/jrnl/develop/docs_theme/assets/readme-header.png"/>
</a> </a>
</p> </p>
@ -8,10 +13,13 @@ jrnl
[![Testing](https://github.com/jrnl-org/jrnl/workflows/Testing/badge.svg)](https://github.com/jrnl-org/jrnl/actions?query=workflow%3ATesting) [![Testing](https://github.com/jrnl-org/jrnl/workflows/Testing/badge.svg)](https://github.com/jrnl-org/jrnl/actions?query=workflow%3ATesting)
[![Downloads](https://pepy.tech/badge/jrnl)](https://pepy.tech/project/jrnl) [![Downloads](https://pepy.tech/badge/jrnl)](https://pepy.tech/project/jrnl)
[![Version](http://img.shields.io/pypi/v/jrnl.svg?style=flat)](https://pypi.python.org/pypi/jrnl/) [![Version](http://img.shields.io/pypi/v/jrnl.svg?style=flat)](https://pypi.python.org/pypi/jrnl/)
[![Homebrew](https://img.shields.io/homebrew/v/jrnl?style=flat-square)](https://formulae.brew.sh/formula/jrnl)
[![Gitter](https://img.shields.io/gitter/room/jrnl-org/jrnl)](https://gitter.im/jrnl-org/jrnl)
[![Changelog](https://img.shields.io/badge/changelog-on%20github-green)](https://github.com/jrnl-org/jrnl/blob/develop/CHANGELOG.md)
==== ====
_To get help, [submit an issue](https://github.com/jrnl-org/jrnl/issues/new/choose) on _To get help, [submit an issue](https://github.com/jrnl-org/jrnl/issues/new/choose) on
Github._ GitHub._
`jrnl` is a simple journal application for the command line. `jrnl` is a simple journal application for the command line.
@ -62,7 +70,7 @@ src="https://opencollective.com/jrnl/contributors.svg?width=890&button=false"
/></a> /></a>
If you'd also like to help make `jrnl` better, please see our [contributing If you'd also like to help make `jrnl` better, please see our [contributing
documentation](CONTRIBUTING.md). documentation](docs/contributing.md).
### Financial Backers ### Financial Backers

7
SECURITY.md Normal file
View file

@ -0,0 +1,7 @@
# Security
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/).

View file

@ -1,76 +1,27 @@
<!-- Copyright (C) 2012-2021 jrnl contributors <!--
License: https://www.gnu.org/licenses/gpl-3.0.html --> Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Advanced Usage # Advanced Usage
## Configuration File ## Configuration File
You can configure the way jrnl behaves in a configuration file. By `jrnl` has a wide variety of options that can be customized through the config file,
default, this is `~/.config/jrnl/jrnl.yaml`. If you have the `XDG_CONFIG_HOME` including templates, formats, multiple journals, and more. See
variable set, the configuration file will be saved as the [configuration file reference](./reference-config-file.md) for details
`$XDG_CONFIG_HOME/jrnl/jrnl.yaml`. or read on for some common use cases.
!!! note ### Multiple journal files
On Windows, the configuration file is typically found at `%USERPROFILE%\.config\jrnl\jrnl.yaml`.
The configuration file is a YAML file with the following options
and can be edited with a plain text editor.
!!! note
Backup your journal and config file before editing. Changes to the config file
can have destructive effects on your journal!
- `journals`
paths to your journal files
- `editor`
if set, executes this command to launch an external editor for
writing your entries, e.g. `vim`. Some editors require special
options to work properly, see `FAQ <recipes>` for details.
- `encrypt`
if `true`, encrypts your journal using AES.
- `tagsymbols`
Symbols to be interpreted as tags. (See note below)
- `default_hour` and `default_minute`
if you supply a date, such as `last thursday`, but no specific
time, the entry will be created at this time
- `timeformat`
how to format the timestamps in your journal, see the [python docs](http://docs.python.org/library/time.html#time.strftime) for reference
- `highlight`
if `true`, tags will be highlighted in cyan.
- `linewrap`
controls the width of the output. Set to `false` if you don't want to wrap long lines.
- `colors`
dictionary that controls the colors used to display journal entries. It has four subkeys, which are: `body`, `date`, `tags`, and `title`. Current valid values are: `BLACK`, `RED`, `GREEN`, `YELLOW`, `BLUE`, `MAGENTA`, `CYAN`, `WHITE`, and `NONE`. `colorama.Fore` is used for colorization, and you can find the [docs here](https://github.com/tartley/colorama#colored-output). To disable colored output, set the value to `NONE`. If you set the value of any color subkey to an invalid color, no color will be used.
- `display_format`
specifies formatter to use, formatters available are:
`boxed`, `fancy`, `json`, `markdown`, `md`, `tags`, `text`, `txt`, `xml`, or `yaml`.
!!! note
Although it seems intuitive to use the `#`
character for tags, there's a drawback: on most shells, this is
interpreted as a meta-character starting a comment. This means that if
you type
> `jrnl Implemented endless scrolling on the #frontend of our website.`
your bash will chop off everything after the `#` before passing it to
`jrnl`. To avoid this, wrap your input into quotation marks like
this:
> `jrnl "Implemented endless scrolling on the #frontend of our website."`
Or use the built-in prompt or an external editor to compose your
entries.
## Multiple journal files
You can configure `jrnl`to use with multiple journals (eg. You can configure `jrnl`to use with multiple journals (eg.
`private` and `work`) by defining more journals in your `jrnl.yaml`, `private` and `work`) by defining more journals in your [config file](./reference-config-file.md),
for example: for example:
``` yaml ``` yaml
journals: journals:
default: ~\journal.txt default: ~/journal.txt
work: ~\work.txt work: ~/work.txt
``` ```
The `default` journal gets created the first time you start `jrnl` The `default` journal gets created the first time you start `jrnl`
@ -91,31 +42,76 @@ If your `jrnl.yaml` looks like this:
``` yaml ``` yaml
encrypt: false encrypt: false
journals: journals:
default: ~/journal.txt default: ~/journal.txt
work: work:
journal: ~/work.txt journal: ~/work.txt
encrypt: true encrypt: true
food: ~/my_recipes.txt food: ~/my_recipes.txt
``` ```
Your `default` and your `food` journals won't be encrypted, however your Your `default` and your `food` journals won't be encrypted, however your
`work` journal will! You can override all options that are present at `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 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 you specify a `journal: ...` key that points to the journal file of
that journal. 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 !!! note
Changing `encrypt` to a different value will not encrypt or decrypt your These overrides allow you to modify ***any*** field of your jrnl configuration. We trust that you know what you are doing.
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.
## 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. # Populate a project's log
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`. jrnl --config-override journals.todo "$(git rev-parse --show-toplevel)/todo.txt" todo find my towel
(Related issue: [#486](https://github.com/jrnl-org/jrnl/issues/486)) # Pass multiple overrides
jrnl --config-override display_format fancy --config-override linewrap 20 \
--config-override colors.title green
```
### Using an alternate config
You can specify an alternate configuration file for the current instance of `jrnl` using `--config-file CONFIG_FILE_PATH` where
`CONFIG_FILE_PATH` is a path to an alternate `jrnl` configuration file.
#### Examples:
``` sh
# Use personalised configuration file for personal journal entries
jrnl --config-file ~/foo/jrnl/personal-config.yaml
# Use alternate configuration file for work-related entries
jrnl --config-file ~/foo/jrnl/work-config.yaml
# Use default configuration file (created on first run)
jrnl
```

132
docs/contributing.md Normal file
View file

@ -0,0 +1,132 @@
<!--
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Contributing to jrnl
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:
* [critical](https://github.com/jrnl-org/jrnl/labels/critical)
* [help wanted](https://github.com/jrnl-org/jrnl/labels/help%20wanted)
* [bug](https://github.com/jrnl-org/jrnl/labels/bug)
* [enhancement](https://github.com/jrnl-org/jrnl/labels/enhancement)
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!

View file

@ -1,5 +1,8 @@
<!-- Copyright (C) 2012-2021 jrnl contributors <!--
License: https://www.gnu.org/licenses/gpl-3.0.html --> Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Encryption # Encryption
## A Note on Security ## A Note on Security
@ -35,6 +38,14 @@ replaces the encrypted journal file with a plain text file. You can also specify
a filename, e.g., `jrnl --decrypt plain_text_copy.txt`, to leave the original a filename, e.g., `jrnl --decrypt plain_text_copy.txt`, to leave the original
encrypted file untouched and create a new plain text file next to it. encrypted file untouched and create a new plain text file next to it.
!!! note
Changing `encrypt` in your [config file](./reference-config-file.md) 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. This is why the above commands are necessary.
## Storing Passwords in Your Keychain ## Storing Passwords in Your Keychain
Nobody can recover or reset your `jrnl` password. If you lose it, Nobody can recover or reset your `jrnl` password. If you lose it,
@ -89,16 +100,16 @@ something like `pip3 install crytography`)
import base64 import base64
import getpass import getpass
from pathlib import Path from pathlib import Path
from cryptography.fernet import Fernet from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
filepath = input("journal file path: ") filepath = input("journal file path: ")
password = getpass.getpass("Password: ") password = getpass.getpass("Password: ")
with open(Path(filepath),"rb") as f: with open(Path(filepath), "rb") as f:
ciphertext = f.read() ciphertext = f.read()
password = password.encode("utf-8") password = password.encode("utf-8")
@ -112,7 +123,7 @@ kdf = PBKDF2HMAC(
key = base64.urlsafe_b64encode(kdf.derive(password)) key = base64.urlsafe_b64encode(kdf.derive(password))
print(Fernet(key).decrypt(ciphertext).decode('utf-8')) print(Fernet(key).decrypt(ciphertext).decode("utf-8"))
``` ```
**Example for jrnl v1 files**: **Example for jrnl v1 files**:
@ -126,19 +137,19 @@ like `pip3 install pycrypto`)
""" """
import argparse import argparse
from Crypto.Cipher import AES
import getpass import getpass
import hashlib import hashlib
import sys
from Crypto.Cipher import AES
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("filepath", help="journal file to decrypt") parser.add_argument("filepath", help="journal file to decrypt")
args = parser.parse_args() args = parser.parse_args()
pwd = getpass.getpass() pwd = getpass.getpass()
key = hashlib.sha256(pwd.encode('utf-8')).digest() key = hashlib.sha256(pwd.encode("utf-8")).digest()
with open(args.filepath, 'rb') as f: with open(args.filepath, "rb") as f:
ciphertext = f.read() ciphertext = f.read()
crypto = AES.new(key, AES.MODE_CBC, ciphertext[:16]) crypto = AES.new(key, AES.MODE_CBC, ciphertext[:16])

137
docs/external-editors.md Normal file
View file

@ -0,0 +1,137 @@
<!--
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# External editors
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
the `jrnl` config file (`jrnl.yaml`) like this:
```yaml
editor: "C:\\Program Files (x86)\\Notepad++\\notepad++.exe -multiInst -nosession"
```
The double backslashes are needed so `jrnl` can read the file path
correctly. The `-multiInst -nosession` options will cause `jrnl` to open
its own Notepad++ window.
## emacs
To use `emacs` as your editor, edit the `jrnl` config file (`jrnl.yaml`) like this:
```yaml
editor: emacsclient -a "" -c
```
When you're done editing the message, save and `C-x #` to close the buffer and stop the emacsclient process.
## Other editors
If you're using another editor and would like to share, feel free to [contribute documentation](./contributing.md#editing-documentation) on it.

View file

@ -1,5 +1,8 @@
<!-- Copyright (C) 2012-2021 jrnl contributors <!--
License: https://www.gnu.org/licenses/gpl-3.0.html --> Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Formats # Formats
`jrnl` supports a variety of alternate formats. These can be used to display your `jrnl` supports a variety of alternate formats. These can be used to display your
@ -114,6 +117,11 @@ These formats are mainly intended for piping or exporting your journal to other
programs. Even so, they can still be used in the same way as any other format (like programs. Even so, they can still be used in the same way as any other format (like
written to a file, or displayed in your terminal, if you want). written to a file, or displayed in your terminal, if you want).
!!! note
You may see boxed messages like "2 entries found" when using these formats, but
those messages are written to `stderr` instead of `stdout`, and won't be piped when
using the `|` operator.
### JSON ### JSON
``` sh ``` sh
@ -268,13 +276,14 @@ supported by many programs and programming languages.
### YAML ### YAML
``` sh ``` sh
jrnl --format yaml jrnl --format yaml --file 'my_directory/'
``` ```
This outputs your journal into YAML format. YAML is a commonly used data format and is This outputs your journal into YAML format. YAML is a commonly used data format and is
supported by many programs and programming languages. 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 output**: **Example file**:
``` yaml ``` yaml
title: This is the second sample entry title: This is the second sample entry
date: 2020-07-01 20:00 date: 2020-07-01 20:00
@ -332,14 +341,14 @@ jrnl --format json > myjournal.json
If the `--file` argument is a directory, jrnl will export each entry into an individual file: If the `--file` argument is a directory, jrnl will export each entry into an individual file:
``` sh ``` sh
jrnl --format json --file my_entries/ jrnl --format yaml --file my_entries/
``` ```
The contents of `my_entries/` will then look like this: The contents of `my_entries/` will then look like this:
``` output ``` output
my_entries/ my_entries/
|- 2013_06_03_a-beautiful-day.json |- 2013_06_03_a-beautiful-day.yaml
|- 2013_06_07_dinner-with-gabriel.json |- 2013_06_07_dinner-with-gabriel.yaml
|- ... |- ...
``` ```

View file

@ -1,27 +1,20 @@
<!-- Copyright (C) 2012-2021 jrnl contributors <!--
License: https://www.gnu.org/licenses/gpl-3.0.html --> Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Getting started # Getting started
## Installation ## Installation
On Mac and Linux, the easiest way to install `jrnl` is using The easiest way to install `jrnl` is using
[Homebrew](http://brew.sh/): [pipx](https://pipx.pypa.io/stable/installation/)
with [Python](https://www.python.org/) 3.10+:
``` sh
brew install jrnl
```
On other platforms, install `jrnl` using [Python](https://www.python.org/) 3.6+ and [pipx](https://pipxproject.github.io/pipx/):
``` sh ``` sh
pipx install jrnl pipx install jrnl
``` ```
!!! note
`pipx` should be installed through either `brew` or `pip`. Missing dependencies and other issues
may occur when installing `pipx` through `apt` or another package manager. Further installation
instructions can be found in [pipx's documentation](https://pipxproject.github.io/pipx/installation/).
!!! tip !!! tip
Do not use `sudo` while installing `jrnl`. This may lead to path issues. Do not use `sudo` while installing `jrnl`. This may lead to path issues.

65
docs/journal-types.md Normal file
View file

@ -0,0 +1,65 @@
<!--
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Journal Types
`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
[piping](https://en.wikipedia.org/wiki/Redirection_(computing)#Piping)
to export your old journal as `txt` to an import command on your new journal.
For instance, if you have a `projects` journal you would like to import into
a `new` journal, you would run the following after setting up the configuration
for your `new` journal:
```
jrnl projects --format txt | jrnl new --import
```

View file

@ -1,5 +1,8 @@
<!-- Copyright (C) 2012-2021 jrnl contributors <!--
License: https://www.gnu.org/licenses/gpl-3.0.html --> Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Overview # Overview
`jrnl` is a simple journal application for the command line. `jrnl` is a simple journal application for the command line.
@ -36,7 +39,7 @@ read them or edit them.
`jrnl` plays nicely with your favorite text editor. You may prefer to write `jrnl` plays nicely with your favorite text editor. You may prefer to write
journal entries in an editor. Or you may want to make changes that require a journal entries in an editor. Or you may want to make changes that require a
more comprehensive application. `jrnl` can filter specific entries and pass them more comprehensive application. `jrnl` can filter specific entries and pass them
to the external editor of your choice. to the [external editor](./external-editors.md) of your choice.
## Encryption ## Encryption

View file

@ -1,5 +1,8 @@
<!-- Copyright (C) 2012-2021 jrnl contributors <!--
License: https://www.gnu.org/licenses/gpl-3.0.html --> Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Privacy and Security # Privacy and Security
`jrnl` is designed with privacy and security in mind, but like any other `jrnl` is designed with privacy and security in mind, but like any other
@ -11,6 +14,35 @@ program there are some limitations to be aware of.
passwords can be easily circumvented by someone with basic security skills passwords can be easily circumvented by someone with basic security skills
to access to your encrypted `jrnl` file. to access to your encrypted `jrnl` file.
## Plausible deniability
You may be able to hide the contents of your journal behind a layer of encryption,
but if someone has access to your configuration file, then they can figure out that
you have a journal, where that journal file is, and when you last edited it.
With a sufficient power imbalance, someone may be able to force you to unencrypt
it through non-technical means.
## Spying
While `jrnl` can protect against unauthorized access to your journal entries while
it isn't open, it cannot protect you against an unsafe computer/location.
For example:
- Someone installs a keylogger, tracking what you type into your journal.
- Someone watches your screen while you write your entry.
- Someone installs a backdoor into `jrnl` or poisons your journal into revealing your entries.
## Saved Passwords
When creating an encrypted journal, you'll be prompted as to whether or not you
want to "store the password in your keychain." This keychain is accessed using
the [Python keyring library](https://pypi.org/project/keyring/), which has different
behavior depending on your operating system.
In Windows, the keychain is the Windows Credential Manager (WCM), which can't be locked
and can be accessed by any other application running under your username. If this is
a concern for you, you may not want to store your password.
## Shell history ## Shell history
Since you can enter entries from the command line, any tool that logs command Since you can enter entries from the command line, any tool that logs command
@ -75,16 +107,125 @@ unencrypted temporary remains on your disk. If your computer were to shut off
during this time, or the `jrnl` process were killed unexpectedly, then the during this time, or the `jrnl` process were killed unexpectedly, then the
unencrypted temporary file will remain on your disk. You can mitigate this unencrypted temporary file will remain on your disk. You can mitigate this
issue by only saving with your editor right before closing it. You can also issue by only saving with your editor right before closing it. You can also
manually delete these files (i.e. files named `jrnl_*.txt`) from your temporary manually delete these files from your temporary folder. By default, they
folder. are named `jrnl*.jrnl`, but if you use a
[template](reference-config-file.md#template), they will have the same
extension as the template.
## Plausible deniability ## Editor history
You may be able to hide the contents of your journal behind a layer of encryption, Some editors keep usage history stored on disk for future use. This can be a
but if someone has access to your configuration file, then they can figure out that security risk in the sense that sensitive information can leak via recent
you have a journal, where that journal file is, and when you last edited it. search patterns or editor commands.
With a sufficient power imbalance, someone may be able to force you to unencrypt
it through non-technical means. ### Visual Studio Code
Visual Studio Code stores the contents of saved files to allow you to restore or
review the contents later. You can disable this feature for all files by unchecking
the `workbench.localHistory.enabled` setting in the
[Settings editor](https://code.visualstudio.com/docs/getstarted/settings#_settings-editor).
Alternatively, you can disable this feature for specific files by configuring a
[pattern](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options)
in the `workbench.localHistory.exclude` setting. To exclude unencrypted temporary files generated
by `jrnl`, you can set the `**/jrnl*.jrnl` (unless you are using a
[template](reference-config-file.md#template)) pattern for the `workbench.localHistory.exclude` setting
in the [Settings editor](https://code.visualstudio.com/docs/getstarted/settings#_settings-editor).
!!! note
On Windows, the history location is typically found at
`%APPDATA%\Code\User\History`.
Visual Studio Code also creates a copy of all unsaved files that are open.
It stores these copies in a backup location that's automatically cleaned when
you save the file. However, if your computer shuts off before you save the file,
or the Visual Studio Code process stops unexpectedly, then an unencrypted
temporary file may remain on your disk. You can manually delete these files
from the backup location.
!!! note
On Windows, the backup location is typically found at
`%APPDATA%\Code\Backups`.
### Vim
Vim stores progress data in a so called Viminfo file located at `~/.viminfo`
which contains all sorts of user data including command line history, search
string history, search/substitute patterns, contents of register etc. Also to
be able to recover opened files after an unexpected application close Vim uses
swap files.
These options as well as other leaky features can be disabled by setting the
`editor` key in the Jrnl settings like this:
``` yaml
editor: "vim -c 'set viminfo= noswapfile noundofile nobackup nowritebackup noshelltemp history=0 nomodeline secure'"
```
To disable all plugins and custom configurations and start Vim with the default
configuration `-u NONE` can be passed on the command line as well. This will
ensure that any rogue plugins or other difficult to catch information leaks are
eliminated. The downside to this is that the editor experience will decrease
quite a bit.
To instead let Vim automatically detect when a Jrnl file is being edited an
autocommand can be used. Place this in your `~/.vimrc`:
``` vim
autocmd BufNewFile,BufReadPre *.jrnl setlocal viminfo= noswapfile noundofile nobackup nowritebackup noshelltemp history=0 nomodeline secure
```
!!! note
If you're using a [template](reference-config-file.md#template), you will
have to use the template's file extension instead of `.jrnl`.
See `:h <option>` in Vim for more information about the options mentioned.
### Neovim
Neovim strives to be mostly compatible with Vim and has therefore similar
functionality as Vim. One difference in Neovim is that the Viminfo file is
instead called the ShaDa ("shared data") file which resides in
`~/.local/state/nvim` (`~/.local/share/nvim` pre Neovim v0.8.0). The ShaDa file
can be disabled in the same way as for Vim.
``` yaml
editor: "nvim -c 'set shada= noswapfile noundofile nobackup nowritebackup noshelltemp history=0 nomodeline secure'"
```
`-u NONE` can be passed here as well to start a session with the default configs.
As for Vim above we can create an autocommand in Vimscript:
``` vim
autocmd BufNewFile,BufReadPre *.jrnl setlocal shada= noswapfile noundofile nobackup nowritebackup noshelltemp history=0 nomodeline secure
```
or the same but in Lua:
``` lua
vim.api.nvim_create_autocmd( {"BufNewFile","BufReadPre" }, {
group = vim.api.nvim_create_augroup("PrivateJrnl", {}),
pattern = "*.jrnl",
callback = function()
vim.o.shada = ""
vim.o.swapfile = false
vim.o.undofile = false
vim.o.backup = false
vim.o.writebackup = false
vim.o.shelltemp = false
vim.o.history = 0
vim.o.modeline = false
vim.o.secure = true
end,
})
```
!!! note
If you're using a [template](reference-config-file.md#template), you will
have to use the template's file extension instead of `.jrnl`.
Please see `:h <option>` in Neovim for more information about the options mentioned.
## Notice any other risks? ## Notice any other risks?

View file

@ -1,236 +0,0 @@
<!-- Copyright (C) 2012-2021 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html -->
# FAQ
## Recipes
### Co-occurrence of tags
If I want to find out how often I mentioned my flatmates Alberto and
Melo in the same entry, I run
```sh
jrnl @alberto --tags | grep @melo
```
And will get something like `@melo: 9`, meaning there are 9 entries
where both `@alberto` and `@melo` are tagged. How does this work? First,
`jrnl @alberto` will filter the journal to only entries containing the
tag `@alberto`, and then the `--tags` option will print out how often
each tag occurred in this filtered journal. Finally, we pipe this to
`grep` which will only display the line containing `@melo`.
### Combining filters
You can do things like
```sh
jrnl @fixed -starred -n 10 -to "jan 2013" --short
```
To get a short summary of the 10 most recent, favourited entries before
January 1, 2013 that are tagged with `@fixed`.
### Statistics
How much did I write last year?
```sh
jrnl -from "jan 1 2013" -to "dec 31 2013" | wc -w
```
Will give you the number of words you wrote in 2013. How long is my
average entry?
```sh
expr $(jrnl --export text | wc -w) / $(jrnl --short | wc -l)
```
This will first get the total number of words in the journal and divide
it by the number of entries (this works because `jrnl --short` will
print exactly one line per entry).
### Importing older files
If you want to import a file as an entry to jrnl, you can just do `jrnl < entry.ext`. But what if you want the modification date of the file to
be the date of the entry in jrnl? Try this
```sh
echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' entry.txt` `cat entry.txt` | jrnl
```
The first part will format the modification date of `entry.txt`, and
then combine it with the contents of the file before piping it to jrnl.
If you do that often, consider creating a function in your `.bashrc` or
`.bash_profile`
```sh
jrnlimport () {
echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' $1` `cat $1` | jrnl
}
```
### Using templates
!!! note
Templates require an [external editor](./advanced.md) be configured.
A template is a code snippet that makes it easier to use repeated text
each time a new journal entry is started. There are two ways you can utilize
templates in your entries.
#### 1. Command line arguments
If you had a `template.txt` file with the following contents:
```sh
My Personal Journal
Title:
Body:
```
The `template.txt` file could be used to create a new entry with these
command line arguements:
```sh
jrnl < template.txt # Imports template.txt as the most recent entry
jrnl -1 --edit # Opens the most recent entry in the editor
```
#### 2. Include the template file in `jrnl.yaml`
A more efficient way to work with a template file is to declare the file
in your config file by changing the `template` setting from `false` to the
template file's path in double quotes:
```sh
...
template: "/path/to/template.txt"
...
```
Changes can be saved as you continue writing the journal entry and will be
logged as a new entry in the journal you specified in the original argument.
!!! 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
`jrnl.yaml` [config file](../advanced/#configuration-file).
### Display random entry
You can use this to select one title at random and then display the whole
entry. The invocation of `cut` needs to match the format of the timestamp.
For timestamps that have a space between data and time components, select
fields 1 and 2 as shown. For timestamps that have no whitespace, select
only field 1.
```sh
jrnl -on "$(jrnl --short | shuf -n 1 | cut -d' ' -f1,2)"
```
## External editors
Configure your preferred external editor by updating the `editor` option
in your `jrnl.yaml` file. (See [advanced usage](./advanced.md) for details).
!!! note
To save and log any entry edits, save and close the file.
If your editor is not in your operating system's `PATH` environment variable,
then you will have to enter in the full path of your editor.
### 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"
```
### 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
the jrnl config file (`jrnl.yaml`) like this:
```yaml
editor: "C:\\Program Files (x86)\\Notepad++\\notepad++.exe -multiInst -nosession"
```
The double backslashes are needed so jrnl can read the file path
correctly. The `-multiInst -nosession` options will cause jrnl to open
its own Notepad++ window.

View file

@ -0,0 +1,141 @@
<!--
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Command Line Reference
## Synopsis
```
usage: jrnl [--debug] [--help] [--version] [--list] [--encrypt] [--decrypt]
[--import] [-on DATE] [-today-in-history] [-month DATE]
[-day DATE] [-year DATE] [-from DATE] [-to DATE] [-contains TEXT]
[-and] [-starred] [-n [NUMBER]] [-not [TAG]] [--edit] [--delete]
[--format TYPE] [--tags] [--short]
[--config-override CONFIG_KEY CONFIG_VALUE]
[--config-file CONFIG_FILE_PATH]
[[...]]
```
## Standalone Commands
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).

View file

@ -0,0 +1,123 @@
<!--
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Configuration File Reference
`jrnl` stores its information in a YAML configuration file.
!!! note
Backup your journal and config file before editing. Changes to the config file
can have destructive effects on your journal!
## Config location
You can find your configuration file location by running:
`jrnl --list`
By default, the configuration file is `~/.config/jrnl/jrnl.yaml`.
If you have the `XDG_CONFIG_HOME` variable set, the configuration
file will be saved as `$XDG_CONFIG_HOME/jrnl/jrnl.yaml`.
!!! note
On Windows, the configuration file is typically found at
`%USERPROFILE%\.config\jrnl\jrnl.yaml`.
## Config format
The configuration file is a [YAML](https://yaml.org/) file and can be edited with
a text editor.
## Config keys
### journals
Describes each journal used by `jrnl`. Each indented key after this key is
the name of a journal.
If a journal key has a value, that value will be interpreted as the path
to the journal. Otherwise, the journal needs the additional indented key
`journal` to specify its path.
All keys below can be specified for each journal at the same level as the
`journal` key. If a key conflicts with a top-level key, the journal-specific
key will be used instead.
### editor
If set, executes this command to launch an external editor for
writing and editing your entries. The path to a temporary file
is passed after it, and `jrnl` processes the file once
the editor returns control to `jrnl`.
Some editors require special options to work properly, since they must be
blocking processes to work with `jrnl`. See [External Editors](external-editors.md)
for details.
### encrypt
If `true`, encrypts your journal using AES. Do not change this
value for journals that already have data in them.
### template
The path to a text file to use as a template for new entries. Only works when you
have the `editor` field configured. If you use a template, the editor's
[temporary files](privacy-and-security.md#files-in-transit-from-editor-to-jrnl)
will have the same extension as the template.
### tagsymbols
Symbols to be interpreted as tags.
!!! note
Although it seems intuitive to use the `#`
character for tags, there's a drawback: on most shells, this is
interpreted as a meta-character starting a comment. This means that if
you type
> `jrnl Implemented endless scrolling on the #frontend of our website.`
your bash will chop off everything after the `#` before passing it to
`jrnl`. To avoid this, wrap your input into quotation marks like
this:
> `jrnl "Implemented endless scrolling on the #frontend of our website."`
Or use the built-in prompt or an external editor to compose your
entries.
### default_hour and default_minute
Entries will be created at this time if you supply a date but no specific time (for example, `last thursday`).
### timeformat
Defines how to format the timestamps as they are stored in your journal.
See the [python docs](http://docs.python.org/library/time.html#time.strftime) for reference.
Do not change this for an existing journal, since that might lead
to data loss.
!!! note
`jrnl` doesn't support the `%z` or `%Z` time zone identifiers.
### highlight
If `true`, tags will be highlighted in cyan.
### linewrap
Controls the width of the output. Set to `false` if you don't want to
wrap long lines. Set to `auto` to let `jrnl` automatically determine
the terminal width.
### colors
A dictionary that controls the colors used to display journal entries.
It has four subkeys, which are: `body`, `date`, `tags`, and `title`.
Current valid values are: `BLACK`, `RED`, `GREEN`, `YELLOW`, `BLUE`,
`MAGENTA`, `CYAN`, `WHITE`, and `NONE`.
`colorama.Fore` is used for colorization, and you can find the [docs here](https://github.com/tartley/colorama#colored-output).
To disable colored output, set the value to `NONE`.
### display_format
Specifies formatter to use by default. See [formats](formats.md).
### version
`jrnl` automatically updates this field to the version that it is running.
There is no need to change this field manually.

224
docs/tips-and-tricks.md Normal file
View file

@ -0,0 +1,224 @@
<!--
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Tips and Tricks
This page contains tips and tricks for using `jrnl`, often in conjunction
with other tools, including external editors.
## Co-occurrence of tags
If I want to find out how often I mentioned my flatmates Alberto and
Melo in the same entry, I run
```sh
jrnl @alberto --tags | grep @melo
```
And will get something like `@melo: 9`, meaning there are 9 entries
where both `@alberto` and `@melo` are tagged. How does this work? First,
`jrnl @alberto` will filter the journal to only entries containing the
tag `@alberto`, and then the `--tags` option will print out how often
each tag occurred in this filtered journal. Finally, we pipe this to
`grep` which will only display the line containing `@melo`.
## Combining filters
You can do things like
```sh
jrnl @fixed -starred -n 10 -to "jan 2013" --short
```
To get a short summary of the 10 most recent, favourite entries before
January 1, 2013 that are tagged with `@fixed`.
## Statistics
How much did I write last year?
```sh
jrnl -from "jan 1 2013" -to "dec 31 2013" | wc -w
```
Will give you the number of words you wrote in 2013. How long is my
average entry?
```sh
expr $(jrnl --export text | wc -w) / $(jrnl --short | wc -l)
```
This will first get the total number of words in the journal and divide
it by the number of entries (this works because `jrnl --short` will
print exactly one line per entry).
## Importing older files
If you want to import a file as an entry to `jrnl`, you can just do `jrnl < entry.ext`. But what if you want the modification date of the file to
be the date of the entry in `jrnl`? Try this
```sh
echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' entry.txt` `cat entry.txt` | jrnl
```
The first part will format the modification date of `entry.txt`, and
then combine it with the contents of the file before piping it to jrnl.
If you do that often, consider creating a function in your `.bashrc` or
`.bash_profile`
```sh
jrnlimport () {
echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' $1` `cat $1` | jrnl
}
```
## Using Templates
!!! note
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
`jrnl.yaml` [config file](../advanced/#configuration-file).
## Display random entry
You can use this to select one title at random and then display the whole
entry. The invocation of `cut` needs to match the format of the timestamp.
For timestamps that have a space between data and time components, select
fields 1 and 2 as shown. For timestamps that have no whitespace, select
only field 1.
```sh
jrnl -on "$(jrnl --short | shuf -n 1 | cut -d' ' -f1,2)"
```
## Launch a terminal for rapid logging
You can use this to launch a terminal that is the `jrnl` stdin prompt so you can start typing away immediately.
```bash
jrnl --config-override editor ""
```
Bind this to a keyboard shortcut.
Map `Super+Alt+J` to launch the terminal with `jrnl` prompt
- **xbindkeys**
In your `.xbindkeysrc`
```ini
Mod4+Mod1+j
alacritty -t floating-jrnl -e jrnl --config-override editor "",
```
- **I3 WM** Launch a floating terminal with the `jrnl` prompt
```ini
bindsym Mod4+Mod1+j exec --no-startup-id alacritty -t floating-jrnl -e jrnl --config-override editor ""
for_window[title="floating *"] floating enable
```
## Visualize Formatted Markdown in the CLI
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('.')))"
```

View file

@ -1,5 +1,8 @@
<!-- Copyright (C) 2012-2021 jrnl contributors <!--
License: https://www.gnu.org/licenses/gpl-3.0.html --> Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
# Basic Usage # # Basic Usage #
`jrnl` has two modes: **composing** and **viewing**. Whenever you don't enter `jrnl` has two modes: **composing** and **viewing**. Whenever you don't enter
@ -55,14 +58,15 @@ If you don't specify a date and time (e.g., `jrnl finished writing letter to bro
If you don't use a timestamp, `jrnl` will create an entry using the current 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 time. If you use a date only (no time), `jrnl` will use the default time
specified in your configuration file (see [advanced usage](./advanced.md)). specified in your [configuration file](./reference-config-file.md#default_hour-and-default_minute).
Behind the scenes, `jrnl` reorganizes entries in chronological order. Behind the scenes, `jrnl` reorganizes entries in chronological order.
### Using Tags ### ### Using Tags ###
`jrnl` supports tags. The default tag symbol is `@` (largely because `#` is a `jrnl` supports tags. The default tag symbol is `@` (largely because `#` is a
reserved character). You can specify your own tag symbol in the configuration reserved character). You can specify your own tag symbol in the
file. To use tags, preface the desired tag with the symbol: [configuration file](./reference-config-file.md#tagsymbols). To use tags, preface the
desired tag with the symbol:
```sh ```sh
jrnl Had a wonderful day at the @beach with @Tom and @Anna. jrnl Had a wonderful day at the @beach with @Tom and @Anna.
@ -157,7 +161,7 @@ jrnl -n 5 @pinkie -and @WorldDomination
displays the last five entries containing _both_ `@pinkie` _and_ displays the last five entries containing _both_ `@pinkie` _and_
`@worldDomination`. You can change which symbols you'd like to use for tagging `@worldDomination`. You can change which symbols you'd like to use for tagging
in the configuration. in the [configuration file](./reference-config-file.md#tagsymbols).
!!! note !!! note
Entering `jrnl @pinkie @WorldDomination` will display entries in which both Entering `jrnl @pinkie @WorldDomination` will display entries in which both
@ -183,8 +187,8 @@ jrnl -starred
You can edit entries after writing them. This is particularly useful when your 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 journal file is encrypted. To use this feature, you need to have an external
editor configured in your configuration file. You can also edit only the entries editor configured in your [configuration file](./reference-config-file.md#editor). You
that match specific search criteria. For example, can also edit only the entries that match specific search criteria. For example,
```sh ```sh
jrnl -to 1950 @texas -and @history --edit jrnl -to 1950 @texas -and @history --edit
@ -248,5 +252,5 @@ To list all of your journals:
jrnl --list jrnl --list
``` ```
The journals displayed correspond to those specified in the `jrnl` configuration The journals displayed correspond to those specified in the `jrnl`
file. [configuration file](./reference-config-file.md#journals).

View file

@ -1,5 +1,7 @@
/* Copyright (C) 2012-2021 jrnl contributors /*
License: https://www.gnu.org/licenses/gpl-3.0.html */ Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
*/
:root { :root {
/* For dark bg */ /* For dark bg */

View file

@ -1,4 +1,7 @@
/* /*
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
Atom One Dark With support for ReasonML by Gidi Morris, based off work by Atom One Dark With support for ReasonML by Gidi Morris, based off work by
Daniel Gamage Daniel Gamage
@ -136,3 +139,9 @@ Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax
.rst-content .tip .admonition { .rst-content .tip .admonition {
background: var(--light-blue); background: var(--light-blue);
} }
/* hack to bypass a11y issue with conflicting highlight.css files */
code.language-xml span.hljs-meta span.hljs-string {
color: var(--green) !important;
}

View file

@ -1,5 +1,8 @@
/* Copyright (C) 2012-2021 jrnl contributors /*
License: https://www.gnu.org/licenses/gpl-3.0.html */ Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
*/
/* reset */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0} /* reset */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}
body { body {

View file

@ -1,5 +1,7 @@
/* Copyright (C) 2012-2021 jrnl contributors /*
License: https://www.gnu.org/licenses/gpl-3.0.html */ Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
*/
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/* Overrides for jrnl theme */ /* Overrides for jrnl theme */
@ -51,6 +53,14 @@ h2 {
margin-top: 40px; margin-top: 40px;
} }
h3 {
font-size: 1.1em;
}
h4 {
font-size: 1em;
}
p, p,
td, td,
tr, tr,
@ -71,9 +81,26 @@ div.rst-content {
max-width: 54em; max-width: 54em;
} }
.wy-side-nav-search, .wy-side-nav-search,
.wy-menu-vertical li.current { .wy-menu-vertical li.current,
.wy-menu-vertical li.toctree-l1.current > a,
.wy-menu-vertical li.toctree-l2.current > a,
.wy-menu-vertical li.toctree-l3.current > a {
background-color: transparent; background-color: transparent;
border: none;
}
.wy-menu-vertical li.toctree-l2.current li.toctree-l3,
.wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a {
background: transparent;
}
.wy-menu-vertical li.toctree-l4,
.wy-menu-vertical li.toctree-l5,
.wy-menu-vertical li.toctree-l6,
.wy-menu-vertical li.toctree-l7 {
display: none;
} }
.wy-nav-top { .wy-nav-top {
@ -91,7 +118,7 @@ div.rst-content {
background-size: 100%; background-size: 100%;
} }
a.icon-home:before { .wy-side-nav-search a.icon-home:before {
display: block; display: block;
width: 84px; width: 84px;
height: 70px; height: 70px;
@ -107,7 +134,9 @@ a.icon-home:before {
line-height: 2em; line-height: 2em;
} }
.wy-menu-vertical a:hover { .wy-menu-vertical a:hover,
.wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a:hover,
.wy-menu-vertical li.current a:hover {
background-color: var(--black-shadow); background-color: var(--black-shadow);
color: var(--white); color: var(--white);
} }
@ -119,14 +148,10 @@ a.icon-home:before {
position: relative; position: relative;
} }
.wy-menu-vertical li.current>a { .wy-menu-vertical li.toctree-l1.current > a {
background: var(--darkest-purple); background: var(--darkest-purple);
border: none !important; border: none !important;
} pointer-events: none;
.wy-menu-vertical li.current>a:hover {
background: var(--darkest-purple);
border: none;
} }
.wy-menu-vertical li.on a, .wy-menu-vertical li.on a,
@ -135,7 +160,7 @@ a.icon-home:before {
} }
.wy-menu-vertical li.on a, .wy-menu-vertical li.on a,
.wy-menu-vertical li.current>a:after { .wy-menu-vertical li > a.current:after {
position: absolute; position: absolute;
right: 0em; right: 0em;
z-index: 999; z-index: 999;
@ -146,11 +171,6 @@ a.icon-home:before {
border-bottom: 1em solid transparent; border-bottom: 1em solid transparent;
border-right: 1em solid var(--white); border-right: 1em solid var(--white);
} }
.wy-menu-vertical li li.toctree-l2 {
font-weight: 800 !important;
font-size: 50px;
color: red !important;
}
.toctree-expand:before { .toctree-expand:before {
display: none !important; display: none !important;
@ -161,10 +181,14 @@ a.icon-home:before {
display: none; display: none;
} }
.wy-menu-vertical p.caption {
margin-top: 2em;
}
.wy-menu-vertical span { .wy-menu-vertical span {
color: var(--white); color: var(--white);
font-size: 1.2em; font-size: 1.2em;
font-weight: 300; font-weight: 600;
} }
.wy-menu-vertical li a { .wy-menu-vertical li a {
@ -175,7 +199,6 @@ a.icon-home:before {
.wy-nav-side { .wy-nav-side {
background-color: var(--mid-purple); background-color: var(--mid-purple);
background-image: linear-gradient(211deg, var(--mid-purple) 0%, var(--dark-purple) 100%);
font-weight: 300; font-weight: 300;
height: 100%; height: 100%;
} }
@ -206,10 +229,11 @@ form .search-query::placeholder {
background: transparent; background: transparent;
} }
.toctree-l2 a:first-child { .wy-menu-vertical li.current ul {
display: none; background-color: var(--mid-purple);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/* Logo: ; */ /* Logo: ; */
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View file

@ -0,0 +1,49 @@
<!--
Copied from https://github.com/mkdocs/mkdocs/blob/master/mkdocs/themes/readthedocs/breadcrumbs.html
Then lightly modified for accessibility
-->
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="{{ nav.homepage.url|url }}" class="icon icon-home" aria-label="{% trans %}Docs{% endtrans %}"></a> &raquo;</li>
{%- if page %}
{%- for doc in page.ancestors[::-1] %}
{%- if doc.link %}
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> &raquo;</li>
{%- else %}
<li>{{ doc.title }} &raquo;</li>
{%- endif %}
{%- endfor %}
<li>{{ page.title }}</li>
{%- endif %}
<li class="wy-breadcrumbs-aside">
{%- block repo %}
{%- if page and page.edit_url %}
{%- if config.repo_name|lower == 'github' %}
<a href="{{ page.edit_url }}" class="icon icon-github"> {% trans repo_name=config.repo_name %}Edit on {{ repo_name }}{% endtrans %}</a>
{%- elif config.repo_name|lower == 'bitbucket' %}
<a href="{{ page.edit_url }}" class="icon icon-bitbucket"> {% trans repo_name=config.repo_name %}Edit on {{ repo_name }}{% endtrans %}</a>
{%- elif config.repo_name|lower == 'gitlab' %}
<a href="{{ page.edit_url }}" class="icon icon-gitlab"> {% trans repo_name=config.repo_name %}Edit on {{ repo_name }}{% endtrans %}</a>
{%- elif config.repo_name %}
<a href="{{ page.edit_url }}">{% trans repo_name=config.repo_name %}Edit on {{ repo_name }}{% endtrans %}</a>
{%- else %}
<a href="{{ page.edit_url }}">{% trans %}Edit{% endtrans %}</a>
{%- endif %}
{%- endif %}
{%- endblock %}
</li>
</ul>
{%- if config.theme.prev_next_buttons_location|lower in ['top', 'both']
and page and (page.next_page or page.previous_page) %}
<div class="rst-breadcrumbs-buttons" role="navigation" aria-label="{% trans %}Breadcrumb Navigation{% endtrans %}">
{%- if page.previous_page %}
<a href="{{ page.previous_page.url|url }}" class="btn btn-neutral float-left" title="{{ page.previous_page.title }}"><span class="icon icon-circle-arrow-left" aria-hidden="true"></span> {% trans %}Previous{% endtrans %}</a>
{%- endif %}
{%- if page.next_page %}
<a href="{{ page.next_page.url|url }}" class="btn btn-neutral float-right" title="{{ page.next_page.title }}">{% trans %}Next{% endtrans %} <span class="icon icon-circle-arrow-right" aria-hidden="true"></span></a>
{%- endif %}
</div>
{%- endif %}
<hr/>
</div>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

47
docs_theme/index.html Executable file → Normal file
View file

@ -1,5 +1,8 @@
<!-- Copyright (C) 2012-2021 jrnl contributors <!--
License: https://www.gnu.org/licenses/gpl-3.0.html --> Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -7,18 +10,18 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jrnl - The Command Line Journal</title> <title>jrnl - The Command Line Journal</title>
<meta name="description" content="Collect your thoughts and notes without leaving the command line."> <meta name="description" content="Collect your thoughts and notes without leaving the command line.">
<meta name="image" content="https://jrnl.sh/img/banner.png"> <meta name="image" content="https://jrnl.sh/en/stable/img/banner_og.png">
<meta itemprop="name" content="jrnl - The Command Line Journal"> <meta itemprop="name" content="jrnl - The Command Line Journal">
<meta itemprop="description" content="Collect your thoughts and notes without leaving the command line."> <meta itemprop="description" content="Collect your thoughts and notes without leaving the command line.">
<meta itemprop="image" content="https://jrnl.sh/img/banner_og.png"> <meta itemprop="image" content="https://jrnl.sh/en/stable/img/banner_og.png">
<meta name="twitter:card" content="summary"> <meta name="twitter:card" content="summary">
<meta name="twitter:title" content="jrnl - The Command Line Journal"> <meta name="twitter:title" content="jrnl - The Command Line Journal">
<meta name="twitter:description" content="Collect your thoughts and notes without leaving the command line."> <meta name="twitter:description" content="Collect your thoughts and notes without leaving the command line.">
<meta name="twitter:creator" content="jrnl"> <meta name="twitter:creator" content="jrnl">
<meta name="twitter:image:src" content="https://jrnl.sh/img/banner_twitter.png"> <meta name="twitter:image:src" content="https://jrnl.sh/en/stable/img/banner_twitter.png">
<meta name="og:title" content="jrnl - The Command Line Journal"> <meta name="og:title" content="jrnl - The Command Line Journal">
<meta name="og:description" content="Collect your thoughts and notes without leaving the command line."> <meta name="og:description" content="Collect your thoughts and notes without leaving the command line.">
<meta name="og:image" content="https://jrnl.sh/img/banner_og.png"> <meta name="og:image" content="https://jrnl.sh/en/stable/img/banner_og.png">
<meta name="og:url" content="https://jrnl.sh"> <meta name="og:url" content="https://jrnl.sh">
<meta name="og:site_name" content="jrnl - The Command Line Journal"> <meta name="og:site_name" content="jrnl - The Command Line Journal">
<meta name="og:type" content="website"> <meta name="og:type" content="website">
@ -35,8 +38,8 @@
"name": "jrnl", "name": "jrnl",
"description": "Collect your thoughts and notes without leaving the command line.", "description": "Collect your thoughts and notes without leaving the command line.",
"operatingSystem": ["macOS", "Windows", "Linux"], "operatingSystem": ["macOS", "Windows", "Linux"],
"thumbnailUrl": "https://jrnl.sh/img/banner_og.png", "thumbnailUrl": "https://jrnl.sh/en/stable/img/banner_og.png",
"installUrl": "https://jrnl.sh/installation", "installUrl": "https://jrnl.sh/en/stable/installation",
"softwareVersion": "2.5" "softwareVersion": "2.5"
} }
</script> </script>
@ -62,7 +65,7 @@
<a href="overview">Documentation</a> <a href="overview">Documentation</a>
<a href="installation" class="cta">Get Started</a> <a href="installation" class="cta">Get Started</a>
<a href="http://github.com/jrnl-org/jrnl" title="View on Github">Fork on GitHub</a> <a href="http://github.com/jrnl-org/jrnl" title="View on Github">Fork on GitHub</a>
<a id="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"><i class="icon twitter"></i>Tell your friends on Twitter</a> <a id="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> </nav>
<div class="flex"> <div class="flex">
<section> <section>
@ -73,22 +76,22 @@
<section> <section>
<i class="icon future"></i> <i class="icon future"></i>
<h3>Future-proof.</h3> <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>
<section> <section>
<i class="icon secure"></i> <i class="icon secure"></i>
<h3>Secure.</h3> <h3>Secure.</h3>
<p>Encrypt your journals with 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&mdash;not even you, if you lose your password!</p>
</section> </section>
<section> <section>
<i class="icon sync"></i> <i class="icon sync"></i>
<h3>Accessible anywhere.</h3> <h3>Accessible anywhere.</h3>
<p>Sync your journals with Dropbox and capture your thoughts where ever you are.</p> <p>Sync your journal files with other tools like Dropbox to capture your thoughts wherever you are.</p>
</section> </section>
<section> <section>
<i class="icon github"></i> <i class="icon github"></i>
<h3>Free &amp; Open Source.</h3> <h3>Free &amp; Open Source.</h3>
<p>jrnl is made by a bunch of really friendly and remarkably attractive people. Maybe even <a href="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 <a href="https://www.github.com/jrnl-org/jrnl" title="Fork jrnl on GitHub">you</a>?</p>
</section> </section>
<section> <section>
<i class="icon folders"></i> <i class="icon folders"></i>
@ -100,21 +103,21 @@
<footer> <footer>
jrnl is made with love by <a href="https://github.com/jrnl-org/jrnl/graphs/contributors" title="Contributors">many fabulous people</a>. If you need help, <a href="https://github.com/jrnl-org/jrnl/issues/new/choose" title="Open a new issue on Github">submit an issue</a> on Github. jrnl is made with love by <a href="https://github.com/jrnl-org/jrnl/graphs/contributors" title="Contributors">many fabulous people</a>. If you need help, <a href="https://github.com/jrnl-org/jrnl/issues/new/choose" title="Open a new issue on Github">submit an issue</a> on Github.
</footer> </footer>
<script src="//cdnjs.cloudflare.com/ajax/libs/typed.js/2.0.10/typed.min.js"></script> <script src="https://unpkg.com/typed.js@2.1.0/dist/typed.umd.js"></script>
<script> <script>
new Typed("#typed", { new Typed("#typed", {
strings: [ strings: [
"jrnl today: Started writing my memoirs. On the command line. Like a boss.", "jrnl Started writing my memoirs on the command line. 🎉🔥💻🔥🎉",
"jrnl yesterday 2pm: used jrnl to keep track of accomplished tasks. The done.txt for my todo.txt", "jrnl yesterday 2pm: used jrnl to keep track of accomplished tasks. The done.txt for my todo.txt",
"jrnl <b>-from</b> 2009 <b>-until</b> may<br /><i>`(Displays all entries from January 2009 to last may)`</i>", "jrnl <b>-from</b> 2019 <b>-until</b> may<br /><i>`(displays all entries from January 2019 to last May)`</i>",
"jrnl A day on the beach with @beth and @frank. Taggidy-tag-tag.", "jrnl A day on the beach with @beth and @frank. Tagging them so I can easily look this up later.",
"jrnl <b>--tags</b><br /><i>`@idea 7<br />@beth 5</i>`", "jrnl <b>--tags</b><br /><i>`@frank 7<br />@beth 5</i>`",
"jrnl <b>--format</b> json<br /><i>`(Outputs your entire journal as json)</i>`", "jrnl <b>--format</b> json<br /><i>`(Outputs your entire journal as json)</i>`",
"jrnl <b>--encrypt</b><br /><i>`(AES encryption. Crack this, NSA)</i>`" "jrnl <b>--encrypt</b><br /><i>`(AES encryption. Don't lose your password!)</i>`"
], ],
typeSpeed: 35, typeSpeed: 20, // less is faster
backSpeed: 15, backSpeed: 10,
backDelay: 2000, backDelay: 2500,
loop: true, loop: true,
showCursor: false showCursor: false
}); });

View file

@ -1,3 +1,8 @@
<!--
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
{% extends "base.html" %} {% extends "base.html" %}
{%- block search_button %} {%- block search_button %}

View file

@ -1 +1,2 @@
mkdocs==1.1 mkdocs>=1.4
jinja2==3.1.6

View file

@ -1,3 +1,8 @@
<!--
Copyright © 2012-2023 jrnl contributors
License: https://www.gnu.org/licenses/gpl-3.0.html
-->
{% extends "main.html" %} {% extends "main.html" %}
{% block content %} {% block content %}

View file

@ -1,155 +0,0 @@
Feature: Reading and writing to journal with custom date formats
Scenario: Dates can include a time
# https://github.com/jrnl-org/jrnl/issues/117
Given we use the config "simple.yaml"
When we run "jrnl 2013-11-30 15:42: Project Started."
Then we should see the message "Entry added"
And the journal should contain "[2013-11-30 15:42] Project Started."
Scenario: Dates can be in the future
# https://github.com/jrnl-org/jrnl/issues/185
Given we use the config "simple.yaml"
When we run "jrnl 26/06/2099: Planet? Earth. Year? 2099."
Then we should see the message "Entry added"
And the journal should contain "[2099-06-26 09:00] Planet?"
Scenario: Loading a sample journal with custom date
Given we use the config "little_endian_dates.yaml"
When we run "jrnl -n 2"
Then we should get no error
And the output should be
"""
09.06.2013 15:39 My first entry.
| Everything is alright
10.07.2013 15:40 Life is good.
| But I'm better.
"""
Scenario Outline: Writing an entry from command line with custom date
Given we use the config "<config>.yaml"
When we run "jrnl <input>"
Then we should see the message "Entry added"
When we run "jrnl -n 1"
Then the output should contain "<output>"
Examples: Day-first Dates
| config | input | output |
| little_endian_dates | 2020-09-19: My first entry. | 19.09.2020 09:00 My first entry. |
| little_endian_dates | 2020-08-09: My second entry. | 09.08.2020 09:00 My second entry. |
| little_endian_dates | 2020-02-29: Test. | 29.02.2020 09:00 Test. |
| little_endian_dates | 2019-02-29: Test. | 2019-02-29: Test. |
| little_endian_dates | 2020-08-32: Test. | 2020-08-32: Test. |
| little_endian_dates | 2032-02-01: Test. | 01.02.2032 09:00 Test. |
| little_endian_dates | 2020-01-01: Test. | 01.01.2020 09:00 Test. |
| little_endian_dates | 2020-12-31: Test. | 31.12.2020 09:00 Test. |
Scenario Outline: Searching for dates with custom date
Given we use the config "<config>.yaml"
When we run "jrnl -on '<input>' --short"
Then the output should be "<output>"
Examples: Day-first Dates
| config | input | output |
| little_endian_dates | 2013-07-10 | 10.07.2013 15:40 Life is good. |
| little_endian_dates | june 9 2013 | 09.06.2013 15:39 My first entry. |
| little_endian_dates | july 10 2013 | 10.07.2013 15:40 Life is good. |
| little_endian_dates | june 2013 | 09.06.2013 15:39 My first entry. |
| little_endian_dates | july 2013 | 10.07.2013 15:40 Life is good. |
# @todo month alone with no year should work
# | little_endian_dates | june | 09.06.2013 15:39 My first entry. |
# | little_endian_dates | july | 10.07.2013 15:40 Life is good. |
Scenario: Writing an entry at the prompt with custom date
Given we use the config "little_endian_dates.yaml"
When we run "jrnl" and enter "2013-05-10: I saw Elvis. He's alive."
Then we should get no error
And the journal should contain "[10.05.2013 09:00] I saw Elvis."
And the journal should contain "He's alive."
Scenario: Viewing today's entries does not print the entire journal
# https://github.com/jrnl-org/jrnl/issues/741
Given we use the config "simple.yaml"
When we run "jrnl -on today"
Then the output should not contain "Life is good"
And the output should not contain "But I'm better."
Scenario Outline: Create entry using day of the week as entry date.
Given we use the config "simple.yaml"
When we run "jrnl <day>: This is an entry on a <day>."
Then we should see the message "Entry added"
When we run "jrnl -1"
Then the output should contain "<day> at 9am" in the local time
And the output should contain "This is an entry on a <day>."
Examples: Days of the week
| day |
| Monday |
| Tuesday |
| Wednesday |
| Thursday |
| Friday |
| Saturday |
| Sunday |
| sunday |
| sUndAy |
Scenario Outline: Create entry using day of the week abbreviations as entry date.
Given we use the config "simple.yaml"
When we run "jrnl <day>: This is an entry on a <weekday>."
Then we should see the message "Entry added"
When we run "jrnl -1"
Then the output should contain "<weekday> at 9am" in the local time
Examples: Days of the week
| day | weekday |
| mon | Monday |
| tue | Tuesday |
| wed | Wednesday |
| thu | Thursday |
| fri | Friday |
| sat | Saturday |
| sun | Sunday |
Scenario: Journals with unreadable dates should still be loaded
Given we use the config "unreadabledates.yaml"
When we run "jrnl -2"
Then the output should contain "I've lost track of time."
And the output should contain "Time has no meaning."
Scenario: Journals with readable dates AND unreadable dates should still contain all data.
Given we use the config "mostlyreadabledates.yaml"
When we run "jrnl -3"
Then the output should contain "Time machines are possible."
Then the output should contain "I'm going to activate the machine."
And the output should contain "I've crossed so many timelines. Is there any going back?"
And the journal should have 3 entries
Scenario: Update near-valid dates after journal is edited
Given we use the config "mostlyreadabledates.yaml"
When we run "jrnl 2222-08-19: I have made it exactly one month into the future."
Then the journal should contain "[2019-07-01 14:23] Entry subject"
Scenario: Integers in square brackets should not be read as dates
Given we use the config "brackets.yaml"
When we run "jrnl -1"
Then the output should contain "[1] line starting with 1"
# broken still
@skip
Scenario: Dayone entries without timezone information are interpreted in current timezone
Given we use the config "dayone.yaml"
When we run "jrnl -until 'feb 2013'"
Then we should get no error
And the output should contain "2013-01-17T18:37Z" in the local time
Scenario: Loading entry with ambiguous time stamp in timezone-aware journal (like Dayone)
#https://github.com/jrnl-org/jrnl/issues/153
Given we use the config "bug153.yaml"
When we run "jrnl -1"
Then we should get no error
And the output should be
"""
2013-10-27 03:27 Some text.
"""

View file

@ -1,229 +0,0 @@
Feature: Delete entries from journal
Scenario Outline: Delete flag allows deletion of single entry
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl -1"
Then the output should contain "2020-09-24 09:14 The third entry finally"
When we run "jrnl --delete" and enter
"""
N
N
Y
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-29 11:11 Entry the first.
2020-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: Configs
| config |
| basic_onefile |
| basic_encrypted |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: Backing out of interactive delete does not change journal
Given we use the config "<config>.yaml"
When we run "jrnl --delete -n 1" and enter
"""
N
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-29 11:11 Entry the first.
2020-08-31 14:32 A second entry in what I hope to be a long series.
2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Delete flag with nonsense input deletes nothing (issue #932)
Given we use the config "<config>.yaml"
When we run "jrnl --delete asdfasdf"
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-29 11:11 Entry the first.
2020-08-31 14:32 A second entry in what I hope to be a long series.
2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Delete flag with tag only deletes tagged entries
Given we use the config "<config>.yaml"
When we run "jrnl --delete @ipsum" and enter
"""
Y
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series.
2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs
| config |
| basic_onefile |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: Delete flag with multiple tags deletes all entries matching any of the tags
Given we use the config "<config>.yaml"
When we run "jrnl --delete @ipsum @tagthree" and enter
"""
Y
Y
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: Configs
| config |
| basic_onefile |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: Delete flag with -and deletes boolean AND of tagged entries
Given we use the config "<config>.yaml"
When we run "jrnl --delete -and @tagone @tagtwo" and enter
"""
Y
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series.
2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs
| config |
| basic_onefile |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: Delete flag with -not does not delete entries from given tag
Given we use the config "<config>.yaml"
When we run "jrnl --delete @tagone -not @ipsum" and enter
"""
Y
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-29 11:11 Entry the first.
2020-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: Configs
| config |
| basic_onefile |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: Delete flag with -from search operator only deletes entries since that date
Given we use the config "<config>.yaml"
When we run "jrnl --delete -from 2020-09-01" and enter
"""
Y
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-29 11:11 Entry the first.
2020-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: Configs
| config |
| basic_onefile |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: Delete flag with -to only deletes entries up to specified date
Given we use the config "<config>.yaml"
When we run "jrnl --delete -to 2020-08-31" and enter
"""
Y
Y
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs
| config |
| basic_onefile |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: Delete flag with -starred only deletes starred entries
Given we use the config "<config>.yaml"
When we run "jrnl --delete -starred" and enter
"""
Y
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-29 11:11 Entry the first.
2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs
| config |
| basic_onefile |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: Delete flag with -contains only entries containing expression
Given we use the config "<config>.yaml"
When we run "jrnl --delete -contains dignissim" and enter
"""
Y
"""
Then we flush the output
When we run "jrnl -99 --short"
Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series.
2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs
| config |
| basic_onefile |
# | basic_folder | @todo
# | basic_dayone | @todo

View file

@ -1,35 +0,0 @@
Feature: Encrypting and decrypting journals
Scenario: Decrypting a journal
Given we use the config "encrypted.yaml"
When we run "jrnl --decrypt" and enter "bad doggie no biscuit"
Then the config for journal "default" should have "encrypt" set to "bool:False"
And we should see the message "Journal decrypted"
And the journal should have 2 entries
@todo
Scenario: Trying to decrypt an already unencrypted journal
# This should warn the user that the journal is already encrypted
Given we use the config "simple.yaml"
When we run "jrnl --decrypt"
Then the config for journal "default" should have "encrypt" set to "bool:False"
And the journal should have 2 entries
@todo
Scenario: Trying to encrypt an already encrypted journal
# This should warn the user that the journal is already encrypted
Scenario: Encrypting a journal
Given we use the config "simple.yaml"
When we run "jrnl --encrypt" and enter
"""
swordfish
swordfish
n
"""
Then we should see the message "Journal encrypted"
And the config for journal "default" should have "encrypt" set to "bool:True"
When we run "jrnl -n 1" and enter "swordfish"
Then we should be prompted for a password
And the output should contain "2013-06-10 15:40 Life is good"

View file

@ -1,86 +0,0 @@
import os
import shutil
from jrnl.os_compat import on_windows
CWD = os.getcwd()
# @see https://behave.readthedocs.io/en/latest/tutorial.html#debug-on-error-in-case-of-step-failures
BEHAVE_DEBUG_ON_ERROR = False
def setup_debug_on_error(userdata):
global BEHAVE_DEBUG_ON_ERROR
BEHAVE_DEBUG_ON_ERROR = userdata.getbool("BEHAVE_DEBUG_ON_ERROR")
def before_all(context):
setup_debug_on_error(context.config.userdata)
# def after_step(context, step):
# if BEHAVE_DEBUG_ON_ERROR and step.status == "failed":
# -- ENTER DEBUGGER: Zoom in on failure location.
# NOTE: Use IPython debugger, same for pdb (basic python debugger).
# import ipdb
# ipdb.post_mortem(step.exc_traceback)
def clean_all_working_dirs():
if os.path.exists("test.txt"):
os.remove("test.txt")
for folder in ("configs", "journals", "cache"):
working_dir = os.path.join("features", folder)
if os.path.exists(working_dir):
shutil.rmtree(working_dir)
def before_feature(context, feature):
# add "skip" tag
# https://stackoverflow.com/a/42721605/4276230
if "skip" in feature.tags:
feature.skip()
return
if "skip_win" in feature.tags and on_windows():
feature.skip("Skipping on Windows")
return
def before_scenario(context, scenario):
"""Before each scenario, backup all config and journal test data."""
# Clean up in case something went wrong
clean_all_working_dirs()
for folder in ("configs", "journals"):
original = os.path.join("features", "data", folder)
working_dir = os.path.join("features", folder)
if not os.path.exists(working_dir):
os.mkdir(working_dir)
for filename in os.listdir(original):
source = os.path.join(original, filename)
if os.path.isdir(source):
shutil.copytree(source, os.path.join(working_dir, filename))
else:
shutil.copy2(source, working_dir)
# add "skip" tag
# https://stackoverflow.com/a/42721605/4276230
if "skip" in scenario.effective_tags:
scenario.skip()
return
if "skip_win" in scenario.effective_tags and on_windows():
scenario.skip("Skipping on Windows")
return
def after_scenario(context, scenario):
"""After each scenario, restore all test data and remove working_dirs."""
if os.getcwd() != CWD:
os.chdir(CWD)
# only clean up if debugging is off and the scenario passed
if BEHAVE_DEBUG_ON_ERROR and scenario.status != "failed":
clean_all_working_dirs()
else:
clean_all_working_dirs()

View file

@ -1,56 +0,0 @@
Feature: Journals iteracting with the file system in a way that users can see
Scenario: Adding entries to a Folder journal should generate date files
Given we use the config "empty_folder.yaml"
When we run "jrnl 23 July 2013: Testing folder journal."
Then we should see the message "Entry added"
When the journal directory is listed
Then the output should contain "2013/07/23.txt" or "2013\07\23.txt"
Scenario: Adding multiple entries to a Folder journal should generate multiple date files
Given we use the config "empty_folder.yaml"
When we run "jrnl 23 July 2013: Testing folder journal."
And we run "jrnl 3/7/2014: Second entry of journal."
Then we should see the message "Entry added"
When the journal directory is listed
Then the output should contain "2013/07/23.txt" or "2013\07\23.txt"
Then the output should contain "2014/03/07.txt" or "2014\03\07.txt"
Scenario: If the journal and its parent directory don't exist, they should be created
Given we use the config "missing_directory.yaml"
Then the journal should not exist
When we run "jrnl This is a new entry in my journal"
Then the journal should exist
When we run "jrnl -n 1"
Then the output should contain "This is a new entry in my journal"
And the journal should have 1 entry
Scenario: If the journal file doesn't exist, then it should be created
Given we use the config "missing_journal.yaml"
Then the journal should not exist
When we run "jrnl This is a new entry in my journal"
Then the journal should exist
When we run "jrnl -n 1"
Then the output should contain "This is a new entry in my journal"
And the journal should have 1 entry
Scenario: Creating journal with relative path should update to absolute path
Given we use the config "missingconfig"
When we run "jrnl hello world" and enter
"""
test.txt
n
"""
And we change directory to "features"
And we run "jrnl -n 1"
Then the output should contain "hello world"
Scenario: the temporary filename suffix should default to ".jrnl"
Given we use the config "editor.yaml"
When we run "jrnl --edit"
Then the temporary filename suffix should be ".jrnl"
Scenario: the temporary filename suffix should be "-{template_filename}"
Given we use the config "editor_markdown_extension.yaml"
When we run "jrnl --edit"
Then the temporary filename suffix should be "-extension.md"

View file

@ -1,579 +0,0 @@
Feature: Custom formats
Scenario Outline: JSON format
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl --format json"
Then we should get no error
And the output should be parsable as json
And "entries" in the json output should have 3 elements
And "tags" in the json output should contain "@ipsum"
And "tags" in the json output should contain "@tagone"
And "tags" in the json output should contain "@tagthree"
And "tags" in the json output should contain "@tagtwo"
And entry 1 should have an array "tags" with 3 elements
And entry 2 should have an array "tags" with 1 elements
And entry 3 should have an array "tags" with 2 elements
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario: Exporting dayone to json
Given we use the config "dayone.yaml"
When we run "jrnl --export json"
Then we should get no error
And the output should be parsable as json
And the json output should contain entries.0.uuid = "4BB1F46946AD439996C9B59DE7C4DDC1"
Scenario Outline: Printing a journal that has multiline entries with tags
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl -n 1 @ipsum"
Then we should get no error
And the output should be
"""
2020-08-29 11:11 Entry the first.
| Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
| quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus
| pellentesque
| augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu
| consequat. Aenean ante ex, elementum ut interdum et, mattis eget lacus. In
| commodo nulla nec tellus placerat, sed ultricies metus bibendum. Duis eget
| venenatis erat. In at dolor dui. @tagone and maybe also @tagtwo.
|
| Curabitur accumsan nunc ac neque tristique, eleifend faucibus justo
| ullamcorper. Suspendisse at mattis nunc. Nullam eget lacinia urna. Suspendisse
| potenti. Ut urna est, venenatis sed ante in, ultrices congue mi. Maecenas eget
| molestie metus. Mauris porttitor dui ornare gravida porta. Quisque sed lectus
| hendrerit, lacinia ante eget, vulputate ante. Aliquam vitae erat non felis
| feugiat sagittis. Phasellus quis arcu fringilla, mattis ligula id, vestibulum
| urna. Vivamus facilisis leo a mi tincidunt condimentum. Donec eu euismod enim.
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu ligula eget
| velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
| porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
| conubia nostra, per inceptos himenaeos.
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: Exporting using filters should only export parts of the journal
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl -until 'August 2020' --format json"
Then the output should be parsable as json
Then we should get no error
And the output should be parsable as json
And "entries" in the json output should have 2 elements
And "tags" in the json output should contain "@ipsum"
And "tags" in the json output should contain "@tagone"
And "tags" in the json output should contain "@tagtwo"
And entry 1 should have an array "tags" with 3 elements
And entry 2 should have an array "tags" with 1 elements
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: Exporting using custom templates
Given we use the config "<config>.yaml"
And we load template "sample.template"
And we use the password "test" if prompted
When we run "jrnl -1 --format sample"
Then the output should be
"""
The third entry finally after weeks without writing.
----------------------------------------------------
I'm so excited about emojis. 💯 🎶 💩
Donec semper pellentesque iaculis. Nullam cursus et justo sit amet venenatis.
Vivamus tempus ex dictum metus vehicula gravida. Aliquam sed sem dolor. Nulla
eget ultrices purus. Quisque at nunc at quam pharetra consectetur vitae quis
dolor. Fusce ultricies purus eu est feugiat, quis scelerisque nibh malesuada.
Quisque egestas semper nibh in hendrerit. Nam finibus ex in mi mattis
vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan justo.
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
ante eget fringilla. @tagthree and also @tagone
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: Increasing Headings on Markdown export
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we open the editor and append
"""
[2020-10-14 13:23] Heading Test
H1-1
=
H1-2
===
H1-3
============================
H2-1
-
H2-2
---
H2-3
----------------------------------
Horizontal Rules (ignore)
---
===
# ATX H1
## ATX H2
### ATX H3
#### ATX H4
##### ATX H5
###### ATX H6
Stuff
More stuff
more stuff again
"""
Then we flush the output
When we run "jrnl -1 --export markdown"
Then the output should be
"""
# 2020
## October
### 2020-10-14 13:23 Heading Test
#### H1-1
#### H1-2
#### H1-3
##### H2-1
##### H2-2
##### H2-3
Horizontal Rules (ignore)
---
===
#### ATX H1
##### ATX H2
###### ATX H3
####### ATX H4
######## ATX H5
######### ATX H6
Stuff
More stuff
more stuff again
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
# | basic_dayone | @todo
Scenario Outline: Add a blank line to Markdown export if there isn't one already
# https://github.com/jrnl-org/jrnl/issues/768
# https://github.com/jrnl-org/jrnl/issues/881
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we open the editor and append
"""
[2020-10-29 11:11] First entry.
[2020-10-29 11:11] Second entry.
[2020-10-29 11:13] Third entry.
"""
Then we flush the output
When we run "jrnl -3 --format markdown"
Then the output should be
"""
# 2020
## October
### 2020-10-29 11:11 First entry.
### 2020-10-29 11:11 Second entry.
### 2020-10-29 11:13 Third entry.
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
# | basic_dayone | @todo
@skip
Scenario Outline: Exporting to XML
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl --export xml"
Then the output should be a valid XML string
And "entries" node in the xml output should have 3 elements
And "tags" in the xml output should contain ["@ipsum", "@tagone", "@tagtwo", "@tagthree"]
And there should be 10 "tag" elements
Examples: configs
| config |
# | basic_onefile | @todo
# | basic_encrypted | @todo
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario: Exporting to XML
Given we use the config "tags.yaml"
And we use the password "test" if prompted
When we run "jrnl --export xml"
Then the output should be a valid XML string
And "entries" node in the xml output should have 2 elements
And "tags" in the xml output should contain ["@idea", "@journal", "@dan"]
And there should be 7 "tag" elements
Scenario Outline: Exporting tags
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl --export tags"
Then the output should be
"""
@tagtwo : 2
@tagone : 2
@tagthree : 1
@ipsum : 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
@todo
Scenario Outline: Exporting fancy
# Needs better emoji support
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl --export fancy"
Then the output should be
"""
2020-08-29 11:11
Entry the first.
Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus
pellentesque
augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu
consequat. Aenean ante ex, elementum ut interdum et, mattis eget lacus. In
commodo nulla nec tellus placerat, sed ultricies metus bibendum. Duis eget
venenatis erat. In at dolor dui. @tagone and maybe also @tagtwo.
Curabitur accumsan nunc ac neque tristique, eleifend faucibus justo
ullamcorper. Suspendisse at mattis nunc. Nullam eget lacinia urna.
Suspendisse
potenti. Ut urna est, venenatis sed ante in, ultrices congue mi. Maecenas
eget
molestie metus. Mauris porttitor dui ornare gravida porta. Quisque sed
lectus
hendrerit, lacinia ante eget, vulputate ante. Aliquam vitae erat non felis
feugiat sagittis. Phasellus quis arcu fringilla, mattis ligula id,
vestibulum
urna. Vivamus facilisis leo a mi tincidunt condimentum. Donec eu euismod
enim.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu ligula eget
velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
conubia nostra, per inceptos himenaeos.
2020-08-31 14:32
A second entry in what I hope to be a long series.
Sed sit amet metus et sapien feugiat elementum. Aliquam bibendum lobortis
leo
vitae tempus. Donec eleifend nec mi non volutpat. Lorem ipsum dolor sit
amet,
consectetur adipiscing elit. Praesent ut sodales libero. Maecenas nisl
lorem,
vestibulum in tempus sit amet, fermentum ut arcu. Donec vel vestibulum
lectus,
eget pretium enim. Maecenas diam nunc, imperdiet vitae pharetra sed, pretium
id
lectus. Donec eu metus et turpis tempor tristique ac non ex. In tellus arcu,
egestas at efficitur et, ultrices vel est. Sed commodo et nibh non
elementum.
Mauris tempus vitae neque vel viverra. @tagtwo all by its lonesome.
Nulla mattis elementum magna, viverra pretium dui fermentum et. Cras vel
vestibulum odio. Quisque sit amet turpis et urna finibus maximus. Interdum
et
malesuada fames ac ante ipsum primis in faucibus. Fusce porttitor iaculis
sem,
non dictum ipsum varius nec. Nulla eu erat at risus gravida blandit non vel
ante. Nam egestas ipsum leo, eu ultricies ipsum tincidunt vel. Morbi a
commodo
eros.
Nullam dictum, nisl ac varius tempus, ex tortor fermentum nisl, non
tempus dolor neque a lorem. Suspendisse a faucibus ex, vel ornare tortor.
Maecenas tincidunt id felis quis semper. Pellentesque enim libero, fermentum
quis metus id, rhoncus euismod magna. Nulla finibus velit eu purus bibendum
interdum. Integer id justo dui. Integer eu tellus in turpis bibendum
blandit.
Quisque auctor lacinia consectetur.
2020-09-24 09:14
The third entry finally after weeks without writing.
I'm so excited about emojis. 💯 🎶 💩
Donec semper pellentesque iaculis. Nullam cursus et justo sit amet
venenatis.
Vivamus tempus ex dictum metus vehicula gravida. Aliquam sed sem dolor.
Nulla
eget ultrices purus. Quisque at nunc at quam pharetra consectetur vitae quis
dolor. Fusce ultricies purus eu est feugiat, quis scelerisque nibh
malesuada.
Quisque egestas semper nibh in hendrerit. Nam finibus ex in mi mattis
vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan
justo.
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
ante eget fringilla. @tagthree and also @tagone
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
@skip_win
Scenario Outline: Export to yaml
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
And we create a cache directory
When we run "jrnl --export yaml -o {cache_dir}"
Then the cache should contain the files
"""
2020-08-29_entry-the-first.md
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md
2020-09-24_the-third-entry-finally-after-weeks-without-writing.md
"""
And the content of file "2020-08-29_entry-the-first.md" in the cache should be
"""
---
title: Entry the first.
date: 2020-08-29 11:11
starred: False
tags: tagone, ipsum, tagtwo
body: |
Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque
augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu
consequat. Aenean ante ex, elementum ut interdum et, mattis eget lacus. In
commodo nulla nec tellus placerat, sed ultricies metus bibendum. Duis eget
venenatis erat. In at dolor dui. @tagone and maybe also @tagtwo.
Curabitur accumsan nunc ac neque tristique, eleifend faucibus justo
ullamcorper. Suspendisse at mattis nunc. Nullam eget lacinia urna. Suspendisse
potenti. Ut urna est, venenatis sed ante in, ultrices congue mi. Maecenas eget
molestie metus. Mauris porttitor dui ornare gravida porta. Quisque sed lectus
hendrerit, lacinia ante eget, vulputate ante. Aliquam vitae erat non felis
feugiat sagittis. Phasellus quis arcu fringilla, mattis ligula id, vestibulum
urna. Vivamus facilisis leo a mi tincidunt condimentum. Donec eu euismod enim.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu ligula eget
velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
conubia nostra, per inceptos himenaeos.
...
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
# | basic_dayone |
@skip_win # @todo YAML exporter does not correctly export emoji on Windows
Scenario Outline: Add a blank line to YAML export if there isn't one already
# https://github.com/jrnl-org/jrnl/issues/768
# https://github.com/jrnl-org/jrnl/issues/881
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
And we create a cache directory
When we run "jrnl --export yaml -o {cache_dir}"
Then the cache should contain the files
"""
2020-08-29_entry-the-first.md
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md
2020-09-24_the-third-entry-finally-after-weeks-without-writing.md
"""
And the content of file "2020-09-24_the-third-entry-finally-after-weeks-without-writing.md" in the cache should be
"""
---
title: The third entry finally after weeks without writing.
date: 2020-09-24 09:14
starred: False
tags: tagone, tagthree
body: |
I'm so excited about emojis. 💯 🎶 💩
Donec semper pellentesque iaculis. Nullam cursus et justo sit amet venenatis.
Vivamus tempus ex dictum metus vehicula gravida. Aliquam sed sem dolor. Nulla
eget ultrices purus. Quisque at nunc at quam pharetra consectetur vitae quis
dolor. Fusce ultricies purus eu est feugiat, quis scelerisque nibh malesuada.
Quisque egestas semper nibh in hendrerit. Nam finibus ex in mi mattis
vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan justo.
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
ante eget fringilla. @tagthree and also @tagone
...
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
# | basic_dayone | @todo
Scenario: Empty DayOne entry bodies should not error
# https://github.com/jrnl-org/jrnl/issues/780
Given we use the config "bug780.yaml"
When we run "jrnl --short"
Then we should get no error
Scenario Outline: --short displays the short version of entries (only the title)
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl -on 2020-08-31 --short"
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: -s displays the short version of entries (only the title)
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl -on 2020-08-31 -s"
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario: Markdown Support from config file
Given we use the config "format_md.yaml"
When we run "jrnl -n 1"
Then the output should be
"""
# 2013
## June
### 2013-06-10 15:40 Life is good.
But I'm better.
"""
Scenario: Text Formatter from config file
Given we use the config "format_text.yaml"
When we run "jrnl -n 1"
Then the output should be
"""
[2013-06-10 15:40] Life is good.
But I'm better.
"""
Scenario Outline: Exporting entries with Cyrillic characters to directory should not fail
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
And we create a cache directory
When we run "jrnl 2020-11-21: Первая"
When we run "jrnl --format md --file {cache_dir} -on 2020-11-21"
Then the cache should contain the files
"""
2020-11-21_первая.md
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: Export date counts
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl 2020-08-31 01:01: Hi."
And we run "jrnl --format dates"
Then the output should be
"""
2020-08-29, 1
2020-08-31, 2
2020-09-24, 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |

View file

@ -1,93 +0,0 @@
Feature: Importing data
Scenario Outline: --import allows new entry from stdin
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl --import" and pipe "[2020-07-05 15:00] Observe and import."
Then we flush the output
When we run "jrnl -c import"
Then the output should contain "Observe and import"
Examples: Configs
| config |
| basic_onefile |
| basic_encrypted |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: --import allows new large entry from stdin
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl --import" and pipe
"""
[2020-07-05 15:00] Observe and import.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis
est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque augue
et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu consequat.
Aenean ante ex, elementum ut interdum et, mattis eget lacus. In commodo nulla nec
tellus placerat, sed ultricies metus bibendum. Duis eget venenatis erat. In at
dolor dui end of entry.
"""
Then we flush the output
When we run "jrnl -on 2020-07-05"
Then the output should contain "2020-07-05 15:00 Observe and import."
And the output should contain "Lorem ipsum"
And the output should contain "end of entry."
Examples: Configs
| config |
| basic_onefile |
| basic_encrypted |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario Outline: --import allows multiple new entries from stdin
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl --import" and pipe
"""
[2020-07-05 15:00] Observe and import.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
[2020-07-05 15:01] Twice as nice.
Sed dignissim sed nisl eu consequat.
"""
Then we flush the output
When we run "jrnl -on 2020-07-05"
Then the output should contain "2020-07-05 15:00 Observe and import."
And the output should contain "Lorem ipsum"
And the output should contain "2020-07-05 15:01 Twice as nice."
And the output should contain "Sed dignissim"
Examples: Configs
| config |
| basic_onefile |
| basic_encrypted |
# | basic_folder | @todo
# | basic_dayone | @todo
Scenario: --import allows import new entries from file
Given we use the config "simple.yaml"
Then the journal should contain "My first entry."
And the journal should contain "Life is good."
But the journal should not contain "I have an @idea"
And the journal should not contain "I met with"
When we run "jrnl --import --file features/journals/tags.journal"
Then the journal should contain "My first entry."
And the journal should contain "Life is good."
And the journal should contain "PROFIT!"
Scenario: --import prioritizes --file over pipe data if both are given
Given we use the config "simple.yaml"
Then the journal should contain "My first entry."
And the journal should contain "Life is good."
But the journal should not contain "I have an @idea"
And the journal should not contain "I met with"
When we run "jrnl --import --file features/journals/tags.journal" and pipe
"""
[2020-07-05 15:00] I should not exist!
"""
Then the journal should contain "My first entry."
And the journal should contain "PROFIT!"
But the journal should not contain "I should not exist!"

View file

@ -1,51 +0,0 @@
Feature: Multiple journals
Scenario: Loading a config with two journals
Given we use the config "multiple.yaml"
Then journal "default" should have 2 entries
And journal "work" should have 0 entries
Scenario: Write to default config by default
Given we use the config "multiple.yaml"
When we run "jrnl this goes to default"
Then journal "default" should have 3 entries
And journal "work" should have 0 entries
Scenario: Write to specified journal
Given we use the config "multiple.yaml"
When we run "jrnl work a long day in the office"
Then journal "default" should have 2 entries
And journal "work" should have 1 entry
Scenario: Tell user which journal was used
Given we use the config "multiple.yaml"
When we run "jrnl work a long day in the office"
Then we should see the message "Entry added to work journal"
Scenario: Write to specified journal with a timestamp
Given we use the config "multiple.yaml"
When we run "jrnl work 23 july 2012: a long day in the office"
Then journal "default" should have 2 entries
And journal "work" should have 1 entry
And journal "work" should contain "2012-07-23"
Scenario: Create new journals as required
Given we use the config "multiple.yaml"
Then journal "ideas" should not exist
When we run "jrnl ideas 23 july 2012: sell my junk on ebay and make lots of money"
Then journal "ideas" should have 1 entry
Scenario: Don't crash if no default journal is specified
Given we use the config "bug343.yaml"
When we run "jrnl a long day in the office"
Then we should see the message "No default journal configured"
Scenario: Don't crash if no file exists for a configured encrypted journal
Given we use the config "multiple.yaml"
When we run "jrnl new_encrypted Adding first entry" and enter
"""
these three eyes
these three eyes
n
"""
Then we should see the message "Encrypted journal 'new_encrypted' created"

View file

@ -1,318 +0,0 @@
Feature: Searching in a journal
Scenario Outline: Displaying entries using -on today should display entries created today
Given we use the config "<config>.yaml"
When we run "jrnl today: Adding an entry right now."
Then we should see the message "Entry added"
When we run "jrnl -on today"
Then the output should contain "Adding an entry right now."
But the output should not contain "Everything is alright"
And the output should not contain "Life is good"
Examples: configs
| config |
| simple |
| empty_folder |
| dayone |
Scenario Outline: Displaying entries using -from day should display correct entries
Given we use the config "<config>.yaml"
When we run "jrnl yesterday: This thing happened yesterday"
Then we should see the message "Entry added"
When we run "jrnl today at 11:59pm: Adding an entry right now."
Then we should see the message "Entry added"
When we run "jrnl tomorrow: A future entry."
Then we should see the message "Entry added"
When we run "jrnl -from today"
Then the output should contain "Adding an entry right now."
And the output should contain "A future entry."
And the output should not contain "This thing happened yesterday"
Examples: configs
| config |
| simple |
| empty_folder |
| dayone |
Scenario Outline: Displaying entries using -from and -to day should display correct entries
Given we use the config "<config>.yaml"
When we run "jrnl yesterday: This thing happened yesterday"
Then we should see the message "Entry added"
When we run "jrnl today at 11:59pm: Adding an entry right now."
Then we should see the message "Entry added"
When we run "jrnl tomorrow: A future entry."
Then we should see the message "Entry added"
When we run "jrnl -from yesterday -to today"
Then the output should contain "This thing happened yesterday"
And the output should contain "Adding an entry right now."
And the output should not contain "A future entry."
Examples: configs
| config |
| simple |
| empty_folder |
| dayone |
Scenario Outline: Searching for a string
Given we use the config "<config>.yaml"
When we run "jrnl -contains first --short"
Then we should get no error
And the output should be
"""
2020-08-29 11:11 Entry the first.
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Searching for a string within tag results
Given we use the config "<config>.yaml"
When we run "jrnl @tagone -contains maybe"
Then we should get no error
And the output should contain "maybe"
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Searching for a string within AND tag results
Given we use the config "<config>.yaml"
When we run "jrnl -and @tagone @tagtwo -contains maybe"
Then we should get no error
And the output should contain "maybe"
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Searching for a string within NOT tag results
Given we use the config "<config>.yaml"
When we run "jrnl -not @tagone -contains lonesome"
Then we should get no error
And the output should contain "lonesome"
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Searching for dates
Given we use the config "<config>.yaml"
When we run "jrnl -on 2020-08-31 --short"
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
Then we flush the output
When we run "jrnl -on 'august 31 2020' --short"
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario: Out of order entries to a Folder journal should be listed in date order
Given we use the config "empty_folder.yaml"
When we run "jrnl 3/7/2014 4:37pm: Second entry of journal."
Then we should see the message "Entry added"
When we run "jrnl 23 July 2013: Testing folder journal."
Then we should see the message "Entry added"
When we run "jrnl -2"
Then the output should be
"""
2013-07-23 09:00 Testing folder journal.
2014-03-07 16:37 Second entry of journal.
"""
Scenario Outline: Searching for all tags should show counts of each tag
Given we use the config "<config>.yaml"
When we run "jrnl --tags"
Then we should get no error
And the output should be
"""
@tagtwo : 2
@tagone : 2
@tagthree : 1
@ipsum : 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Filtering journals should also filter tags
Given we use the config "<config>.yaml"
When we run "jrnl -from 'september 2020' --tags"
Then we should get no error
And the output should be
"""
@tagthree : 1
@tagone : 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Excluding a tag should filter out all entries with that tag
Given we use the config "<config>.yaml"
When we run "jrnl --tags -not @tagtwo"
Then the output should be
"""
@tagthree : 1
@tagone : 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Excluding multiple tags should filter out all entries with those tags
Given we use the config "<config>.yaml"
When we run "jrnl --tags -not @tagone -not @tagthree"
Then the output should be
"""
@tagtwo : 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario: DayOne tag searching should work with tags containing a mixture of upper and lower case.
# https://github.com/jrnl-org/jrnl/issues/354
Given we use the config "dayone.yaml"
When we run "jrnl @plAy"
Then the output should contain "2013-05-17 11:39 This entry has tags!"
Scenario: Loading a sample journal
Given we use the config "simple.yaml"
When we run "jrnl -2"
Then we should get no error
And the output should be
"""
2013-06-09 15:39 My first entry.
| Everything is alright
2013-06-10 15:40 Life is good.
| But I'm better.
"""
Scenario Outline: Searching by month
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl -month 9 --short"
Then the output should be "2020-09-24 09:14 The third entry finally after weeks without writing."
And we flush the output
When we run "jrnl -month Sept --short"
Then the output should be "2020-09-24 09:14 The third entry finally after weeks without writing."
And we flush the output
When we run "jrnl -month September --short"
Then the output should be "2020-09-24 09:14 The third entry finally after weeks without writing."
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: Searching by day
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl -day 31 --short"
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: Searching by year
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl 2019-01-01 01:01: I like this year."
And we run "jrnl -year 2019 --short"
Then the output should be "2019-01-01 01:01 I like this year."
And we flush the output
When we run "jrnl -year 19 --short"
Then the output should be "2019-01-01 01:01 I like this year."
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: Combining month, day, and year search terms
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl -month 08 -day 29 --short"
Then the output should be "2020-08-29 11:11 Entry the first."
And we flush the output
When we run "jrnl -day 29 -year 2020 --short"
Then the output should be "2020-08-29 11:11 Entry the first."
And we flush the output
When we run "jrnl -month 09 -year 2020 --short"
Then the output should be "2020-09-24 09:14 The third entry finally after weeks without writing."
And we flush the output
When we run "jrnl -month 08 -day 29 -year 2020 --short"
Then the output should be "2020-08-29 11:11 Entry the first."
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: Searching today in history
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
And we set current date and time to "2020-08-31 14:32"
When we run "jrnl 2019-08-31 01:01: Hi, from last year."
And we run "jrnl -today-in-history --short"
Then the output should be
"""
2019-08-31 01:01 Hi, from last year.
2020-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario: Loading a DayOne Journal
Given we use the config "dayone.yaml"
When we run "jrnl -from 'feb 2013'"
Then we should get no error
And the output should be
"""
2013-05-17 11:39 This entry has tags!
2013-06-17 20:38 This entry has a location.
2013-07-17 11:38 This entry is starred!
"""

View file

@ -1,648 +0,0 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import ast
from collections import defaultdict
import os
from pathlib import Path
import re
import time
from unittest.mock import patch
from behave import given
from behave import then
from behave import when
import keyring
import toml
import yaml
import jrnl.time
from jrnl import Journal
from jrnl import __version__
from jrnl import plugins
from jrnl.cli import cli
from jrnl.config import load_config
from jrnl.os_compat import split_args
try:
import parsedatetime.parsedatetime_consts as pdt
except ImportError:
import parsedatetime as pdt
consts = pdt.Constants(usePyICU=False)
consts.DOWParseStyle = -1 # Prefers past weekdays
CALENDAR = pdt.Calendar(consts)
class TestKeyring(keyring.backend.KeyringBackend):
"""A test keyring that just stores its values in a hash"""
priority = 1
keys = defaultdict(dict)
def set_password(self, servicename, username, password):
self.keys[servicename][username] = password
def get_password(self, servicename, username):
return self.keys[servicename].get(username)
def delete_password(self, servicename, username):
self.keys[servicename][username] = None
class NoKeyring(keyring.backend.KeyringBackend):
"""A keyring that simulated an environment with no keyring backend."""
priority = 2
keys = defaultdict(dict)
def set_password(self, servicename, username, password):
raise keyring.errors.NoKeyringError
def get_password(self, servicename, username):
raise keyring.errors.NoKeyringError
def delete_password(self, servicename, username):
raise keyring.errors.NoKeyringError
class FailedKeyring(keyring.backend.KeyringBackend):
"""
A keyring that cannot be retrieved.
"""
priority = 2
def set_password(self, servicename, username, password):
raise keyring.errors.KeyringError
def get_password(self, servicename, username):
raise keyring.errors.KeyringError
def delete_password(self, servicename, username):
raise keyring.errors.KeyringError
# set a default keyring
keyring.set_keyring(TestKeyring())
def read_journal(context, journal_name="default"):
configuration = load_config(context.config_path)
with open(configuration["journals"][journal_name]) as journal_file:
journal = journal_file.read()
return journal
def open_journal(context, journal_name="default"):
configuration = load_config(context.config_path)
journal_conf = configuration["journals"][journal_name]
# We can override the default config on a by-journal basis
if type(journal_conf) is dict:
configuration.update(journal_conf)
# But also just give them a string to point to the journal file
else:
configuration["journal"] = journal_conf
return Journal.open_journal(journal_name, configuration)
def read_value_from_string(string):
if string[0] == "{":
# Handle value being a dictionary
return ast.literal_eval(string)
# Takes strings like "bool:true" or "int:32" and coerces them into proper type
t, value = string.split(":")
value = {"bool": lambda v: v.lower() == "true", "int": int, "str": str}[t](value)
return value
@given('we use the config "{config_file}"')
def set_config(context, config_file):
full_path = os.path.join("features/configs", config_file)
context.config_path = os.path.abspath(full_path)
if config_file.endswith("yaml") and os.path.exists(full_path):
# Add jrnl version to file for 2.x journals
with open(context.config_path, "a") as cf:
cf.write("version: {}".format(__version__))
@given('we use the password "{password}" if prompted')
def use_password_forever(context, password):
context.password = password
@given('we use the password "{password}" {num:d} times if prompted')
def use_password(context, password, num=1):
context.password = iter([password] * num)
@given("we have a keyring")
@given("we have a {type} keyring")
def set_keyring(context, type=""):
if type == "failed":
keyring.set_keyring(FailedKeyring())
else:
keyring.set_keyring(TestKeyring())
@given("we do not have a keyring")
def disable_keyring(context):
keyring.core.set_keyring(NoKeyring())
@given('we set current date and time to "{dt}"')
def set_datetime(context, dt):
context.now = dt
@when('we change directory to "{path}"')
def move_up_dir(context, path):
os.chdir(path)
@when("we open the editor and {method}")
@when('we open the editor and {method} "{text}"')
@when("we open the editor and {method} nothing")
@when("we open the editor and {method} nothing")
def open_editor_and_enter(context, method, text=""):
text = text or context.text or ""
if method == "enter":
file_method = "w+"
elif method == "append":
file_method = "a"
else:
file_method = "r+"
def _mock_editor(command):
context.editor_command = command
tmpfile = command[-1]
with open(tmpfile, file_method) as f:
f.write(text)
return tmpfile
if "password" in context:
password = context.password
else:
password = ""
# fmt: off
# see: https://github.com/psf/black/issues/664
with \
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
patch("sys.stdin.isatty", return_value=True), \
patch("jrnl.time.parse", side_effect=_mock_time_parse(context)), \
patch("jrnl.config.get_config_path", side_effect=lambda: context.config_path), \
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
:
context.editor = mock_editor
context.getpass = mock_getpass
try:
cli(["--edit"])
context.exit_status = 0
except SystemExit as e:
context.exit_status = e.code
# fmt: on
@then("the editor should have been called")
@then("the editor should have been called with {num} arguments")
def count_editor_args(context, num=None):
assert context.editor.called
if isinstance(num, int):
assert len(context.editor_command) == int(num)
@then("the editor should not have been called")
def no_editor_called(context, num=None):
assert "editor" not in context or not context.editor.called
@then('one editor argument should be "{arg}"')
def contains_editor_arg(context, arg):
args = context.editor_command
assert (
arg in args and args.count(arg) == 1
), f"\narg not in args exactly 1 time:\n{arg}\n{str(args)}"
@then('one editor argument should match "{regex}"')
def matches_editor_arg(context, regex):
args = context.editor_command
matches = list(filter(lambda x: re.search(regex, x), args))
assert (
len(matches) == 1
), f"\nRegex didn't match exactly 1 time:\n{regex}\n{str(args)}"
@then("the editor file content should {method}")
@then("the editor file content should {method} empty")
@then('the editor file content should {method} "{text}"')
def contains_editor_file(context, method, text=""):
text = text or context.text or ""
content = context.editor_file.get("content")
format = f'\n"""\n{content}\n"""\n'
if method == "be":
assert content == text, format
elif method == "contain":
assert text in content, format
else:
assert False, f"Method '{method}' not supported"
@then('the temporary filename suffix should be "{suffix}"')
def extension_editor_file(context, suffix):
filename = Path(context.editor_file["name"]).name
delimiter = "-" if "-" in filename else "."
filename_suffix = delimiter + filename.split(delimiter)[-1]
assert filename_suffix == suffix
def _mock_getpass(inputs):
def prompt_return(prompt=""):
if type(inputs) == str:
return inputs
try:
return next(inputs)
except StopIteration:
raise KeyboardInterrupt
return prompt_return
def _mock_input(inputs):
def prompt_return(prompt=""):
try:
val = next(inputs)
print(prompt, val)
return val
except StopIteration:
raise KeyboardInterrupt
return prompt_return
def _mock_time_parse(context):
original_parse = jrnl.time.parse
if "now" not in context:
return original_parse
def wrapper(input, *args, **kwargs):
input = context.now if input == "now" else input
return original_parse(input, *args, **kwargs)
return wrapper
@when('we run "{command}" and enter')
@when('we run "{command}" and enter nothing')
@when('we run "{command}" and enter "{inputs}"')
def run_with_input(context, command, inputs=""):
# create an iterator through all inputs. These inputs will be fed one by one
# to the mocked calls for 'input()', 'util.getpass()' and 'sys.stdin.read()'
if context.text:
text = iter(context.text.split("\n"))
else:
text = iter([inputs])
args = split_args(command)[1:]
def _mock_editor(command):
context.editor_command = command
tmpfile = command[-1]
with open(tmpfile, "r") as editor_file:
file_content = editor_file.read()
context.editor_file = {"name": tmpfile, "content": file_content}
Path(tmpfile).touch()
if "password" in context:
password = context.password
else:
password = text
# fmt: off
# see: https://github.com/psf/black/issues/664
with \
patch("builtins.input", side_effect=_mock_input(text)) as mock_input, \
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
patch("sys.stdin.read", side_effect=text) as mock_read, \
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
patch("jrnl.time.parse", side_effect=_mock_time_parse(context)), \
patch("jrnl.config.get_config_path", side_effect=lambda: context.config_path), \
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
:
try:
cli(args or [])
context.exit_status = 0
except SystemExit as e:
context.exit_status = e.code
# put mocks into context so they can be checked later in "then" statements
context.editor = mock_editor
context.input = mock_input
context.getpass = mock_getpass
context.read = mock_read
context.iter_text = text
context.execute_steps('''
Then all input was used
And at least one input method was called
''')
# fmt: on
@then("at least one input method was called")
def inputs_were_called(context):
assert (
context.input.called
or context.getpass.called
or context.read.called
or context.editor.called
)
@then("we should be prompted for a password")
def password_was_called(context):
assert context.getpass.called
@then("we should not be prompted for a password")
def password_was_not_called(context):
assert not context.getpass.called
@then("all input was used")
def all_input_was_used(context):
# all inputs were used (ignore if empty string)
for temp in context.iter_text:
assert "" == temp, "Not all inputs were consumed"
@when('we run "{command}"')
@when('we run "{command}" and pipe')
@when('we run "{command}" and pipe "{text}"')
def run(context, command, text=""):
text = text or context.text or ""
if "cache_dir" in context and context.cache_dir is not None:
cache_dir = os.path.join("features", "cache", context.cache_dir)
command = command.format(cache_dir=cache_dir)
args = split_args(command)
def _mock_editor(command):
context.editor_command = command
tmpfile = command[-1]
with open(tmpfile, "r") as editor_file:
file_content = editor_file.read()
context.editor_file = {"name": tmpfile, "content": file_content}
Path(tmpfile).touch()
if "password" in context:
password = context.password
else:
password = iter(text)
try:
# fmt: off
# see: https://github.com/psf/black/issues/664
with \
patch("sys.argv", args), \
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
patch("sys.stdin.read", side_effect=lambda: text), \
patch("jrnl.time.parse", side_effect=_mock_time_parse(context)), \
patch("jrnl.config.get_config_path", side_effect=lambda: context.config_path), \
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
:
context.editor = mock_editor
context.getpass = mock_getpass
cli(args[1:])
context.exit_status = 0
# fmt: on
except SystemExit as e:
context.exit_status = e.code
@given('we load template "{filename}"')
def load_template(context, filename):
full_path = os.path.join("features/data/templates", filename)
exporter = plugins.template_exporter.__exporter_from_file(full_path)
plugins.__exporter_types[exporter.names[0]] = exporter
@when('we set the keyring password of "{journal}" to "{password}"')
def set_keyring_password(context, journal, password):
keyring.set_password("jrnl", journal, password)
@then("we should get an error")
def has_error(context):
assert context.exit_status != 0, context.exit_status
@then("we should get no error")
def no_error(context):
assert context.exit_status == 0, context.exit_status
@then("we flush the output")
def flush_stdout(context):
context.stdout_capture.truncate(0)
context.stdout_capture.seek(0)
@then("we flush the error output")
def flush_stderr(context):
context.stderr_capture.truncate(0)
context.stderr_capture.seek(0)
@then("we flush all the output")
def flush_all_output(context):
context.execute_steps(
"""
Then we flush the output
Then we flush the error output
"""
)
@then("the output should be")
@then("the output should be empty")
@then('the output should be "{text}"')
def check_output(context, text=None):
text = (text or context.text or "").strip().splitlines()
out = context.stdout_capture.getvalue().strip().splitlines()
assert len(text) == len(out), "Output has {} lines (expected: {})".format(
len(out), len(text)
)
for line_text, line_out in zip(text, out):
assert line_text.strip() == line_out.strip(), [
line_text.strip(),
line_out.strip(),
]
@then('the output should contain "{text}" in the local time')
def check_output_time_inline(context, text):
out = context.stdout_capture.getvalue()
date, flag = CALENDAR.parse(text)
output_date = time.strftime("%Y-%m-%d %H:%M", date)
assert output_date in out, output_date
@then("the output should contain pyproject.toml version")
def check_output_version_inline(context):
out = context.stdout_capture.getvalue()
pyproject = (Path(__file__) / ".." / ".." / ".." / "pyproject.toml").resolve()
pyproject_contents = toml.load(pyproject)
pyproject_version = pyproject_contents["tool"]["poetry"]["version"]
assert pyproject_version in out, pyproject_version
@then("the output should contain")
@then('the output should contain "{text}"')
@then('the output should contain "{text}" or "{text2}"')
def check_output_inline(context, text=None, text2=None):
text = text or context.text
out = context.stdout_capture.getvalue()
assert (text and text in out) or (text2 and text2 in out)
@then("the error output should contain")
@then('the error output should contain "{text}"')
@then('the error output should contain "{text}" or "{text2}"')
def check_error_output_inline(context, text=None, text2=None):
text = text or context.text
out = context.stderr_capture.getvalue()
assert (text and text in out) or (text2 and text2 in out)
@then('the output should match "{regex}"')
@then('the output should match "{regex}" {num} times')
def matches_std_output(context, regex, num=1):
out = context.stdout_capture.getvalue()
matches = re.findall(regex, out)
assert (
matches and len(matches) == num
), f"\nRegex didn't match exactly {num} time(s):\n{regex}\n{str(out)}\n{str(matches)}"
@then('the error output should match "{regex}"')
@then('the error output should match "{regex}" {num} times')
def matches_err_ouput(context, regex, num=1):
out = context.stderr_capture.getvalue()
matches = re.findall(regex, out)
assert (
matches and len(matches) == num
), f"\nRegex didn't match exactly {num} time(s):\n{regex}\n{str(out)}\n{str(matches)}"
@then('the output should not contain "{text}"')
def check_output_not_inline(context, text):
out = context.stdout_capture.getvalue()
assert text not in out
@then('we should see the message "{text}"')
@then('the error output should be "{text}"')
def check_message(context, text):
out = context.stderr_capture.getvalue()
assert text in out, [text, out]
@then('we should not see the message "{text}"')
def check_not_message(context, text):
out = context.stderr_capture.getvalue()
assert text not in out, [text, out]
@then('the journal should contain "{text}"')
@then('journal "{journal_name}" should contain "{text}"')
def check_journal_content(context, text, journal_name="default"):
journal = read_journal(context, journal_name)
assert text in journal, journal
@then('the journal should not contain "{text}"')
@then('journal "{journal_name}" should not contain "{text}"')
def check_not_journal_content(context, text, journal_name="default"):
journal = read_journal(context, journal_name)
assert text not in journal, journal
@then("the journal should not exist")
@then('journal "{journal_name}" should not exist')
def journal_doesnt_exist(context, journal_name="default"):
configuration = load_config(context.config_path)
journal_path = configuration["journals"][journal_name]
assert not os.path.exists(journal_path)
@then("the journal should exist")
@then('journal "{journal_name}" should exist')
def journal_exists(context, journal_name="default"):
configuration = load_config(context.config_path)
journal_path = configuration["journals"][journal_name]
assert os.path.exists(journal_path)
@then('the config should have "{key}" set to')
@then('the config should have "{key}" set to "{value}"')
@then('the config for journal "{journal}" should have "{key}" set to "{value}"')
def config_var(context, key, value="", journal=None):
value = read_value_from_string(value or context.text or "")
configuration = load_config(context.config_path)
if journal:
configuration = configuration["journals"][journal]
assert key in configuration
assert configuration[key] == value
@then('the config for journal "{journal}" should not have "{key}" set')
def config_no_var(context, key, value="", journal=None):
configuration = load_config(context.config_path)
if journal:
configuration = configuration["journals"][journal]
assert key not in configuration
@then("the journal should have {number:d} entries")
@then("the journal should have {number:d} entry")
@then('journal "{journal_name}" should have {number:d} entries')
@then('journal "{journal_name}" should have {number:d} entry')
def check_journal_entries(context, number, journal_name="default"):
journal = open_journal(context, journal_name)
assert len(journal.entries) == number
@when("the journal directory is listed")
def list_journal_directory(context, journal="default"):
with open(context.config_path) as config_file:
configuration = yaml.load(config_file, Loader=yaml.FullLoader)
journal_path = configuration["journals"][journal]
for root, dirnames, f in os.walk(journal_path):
for file in f:
print(os.path.join(root, file))
@then("fail")
def debug_fail(context):
assert False

View file

@ -1,192 +0,0 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import json
import os
import shutil
import random
import string
from xml.etree import ElementTree
from behave import given
from behave import then
@then("the output should be parsable as json")
def check_output_json(context):
out = context.stdout_capture.getvalue()
assert json.loads(out), out
@then('"{field}" in the json output should have {number:d} elements')
@then('"{field}" in the json output should have 1 element')
def check_output_field(context, field, number=1):
out = context.stdout_capture.getvalue()
out_json = json.loads(out)
assert field in out_json, [field, out_json]
assert len(out_json[field]) == number, len(out_json[field])
@then('"{field}" in the json output should not contain "{key}"')
def check_output_field_not_key(context, field, key):
out = context.stdout_capture.getvalue()
out_json = json.loads(out)
assert field in out_json
assert key not in out_json[field]
@then('"{field}" in the json output should contain "{key}"')
def check_output_field_key(context, field, key):
out = context.stdout_capture.getvalue()
struct = json.loads(out)
for node in field.split("."):
try:
struct = struct[int(node)]
except ValueError:
assert node in struct
struct = struct[node]
assert key in struct
@then("the json output should contain {path}")
@then('the json output should contain {path} = "{value}"')
def check_json_output_path(context, path, value=None):
"""E.g.
the json output should contain entries.0.title = "hello"
"""
out = context.stdout_capture.getvalue()
struct = json.loads(out)
for node in path.split("."):
try:
struct = struct[int(node)]
except ValueError:
struct = struct[node]
if value is not None:
assert struct == value, struct
else:
assert struct is not None
@then(
'entry {entry_number:d} should have an array "{name}" with {items_number:d} elements'
)
def entry_array_count(context, entry_number, name, items_number):
# note that entry_number is 1-indexed.
out = context.stdout_capture.getvalue()
out_json = json.loads(out)
assert len(out_json["entries"][entry_number - 1][name]) == items_number
@then("the output should be a valid XML string")
def assert_valid_xml_string(context):
output = context.stdout_capture.getvalue()
xml_tree = ElementTree.fromstring(output)
assert xml_tree, output
@then('"{item}" node in the xml output should have {number:d} elements')
def assert_xml_output_entries_count(context, item, number):
output = context.stdout_capture.getvalue()
xml_tree = ElementTree.fromstring(output)
xml_tags = (node.tag for node in xml_tree)
assert item in xml_tags, str(list(xml_tags))
actual_entry_count = len(xml_tree.find(item))
assert actual_entry_count == number, actual_entry_count
@then('there should be {number:d} "{item}" elements')
def count_elements(context, number, item):
output = context.stdout_capture.getvalue()
xml_tree = ElementTree.fromstring(output)
assert len(xml_tree.findall(".//" + item)) == number
@then('"tags" in the xml output should contain {expected_tags_json_list}')
def assert_xml_output_tags(context, expected_tags_json_list):
output = context.stdout_capture.getvalue()
xml_tree = ElementTree.fromstring(output)
xml_tags = (node.tag for node in xml_tree)
assert "tags" in xml_tags, str(list(xml_tags))
expected_tags = json.loads(expected_tags_json_list)
actual_tags = set(t.attrib["name"] for t in xml_tree.find("tags"))
assert actual_tags == set(expected_tags), [actual_tags, set(expected_tags)]
@given('we create cache directory "{dir_name}"')
@given("we create a cache directory")
def create_directory(context, dir_name=None):
if not dir_name:
dir_name = "cache_" + "".join(
random.choices(string.ascii_uppercase + string.digits, k=20)
)
working_dir = os.path.join("features", "cache", dir_name)
if os.path.exists(working_dir):
shutil.rmtree(working_dir)
os.makedirs(working_dir)
context.cache_dir = dir_name
@then('cache "{dir_name}" should contain the files')
@then('cache "{dir_name}" should contain the files {expected_files_json_list}')
@then("the cache should contain the files")
def assert_dir_contains_files(context, dir_name=None, expected_files_json_list=""):
if not dir_name:
dir_name = context.cache_dir
working_dir = os.path.join("features", "cache", dir_name)
actual_files = os.listdir(working_dir)
expected_files = context.text or expected_files_json_list
expected_files = expected_files.split("\n")
# sort to deal with inconsistent default file ordering on different OS's
actual_files.sort()
expected_files.sort()
assert actual_files == expected_files, [actual_files, expected_files]
@then('the content of file "{file_path}" in cache directory "{cache_dir}" should be')
@then('the content of file "{file_path}" in the cache should be')
def assert_exported_yaml_file_content(context, file_path, cache_dir=None):
if not cache_dir:
cache_dir = context.cache_dir
expected_content = context.text.strip().splitlines()
full_file_path = os.path.join("features", "cache", cache_dir, file_path)
with open(full_file_path, "r") as f:
actual_content = f.read().strip().splitlines()
for actual_line, expected_line in zip(actual_content, expected_content):
if actual_line.startswith("tags: ") and expected_line.startswith("tags: "):
assert_equal_tags_ignoring_order(
actual_line, expected_line, actual_content, expected_content
)
else:
assert actual_line.strip() == expected_line.strip(), [
[actual_line.strip(), expected_line.strip()],
[actual_content, expected_content],
]
def assert_equal_tags_ignoring_order(
actual_line, expected_line, actual_content, expected_content
):
actual_tags = set(tag.strip() for tag in actual_line[len("tags: ") :].split(","))
expected_tags = set(
tag.strip() for tag in expected_line[len("tags: ") :].split(",")
)
assert actual_tags == expected_tags, [
[actual_tags, expected_tags],
[expected_content, actual_content],
]

View file

@ -1,71 +0,0 @@
Feature: Upgrading Journals from 1.x.x to 2.x.x
Scenario: Upgrade and parse journals with square brackets
Given we use the config "upgrade_from_195.json"
When we run "jrnl -9" and enter "Y"
Then the journal should have 2 entries
And the output should contain
"""
2010-06-10 15:00 A life without chocolate is like a bad analogy.
"""
And the output should contain
"""
2013-06-10 15:40 He said "[this] is the best time to be alive".
"""
Scenario: Upgrading a journal encrypted with jrnl 1.x
Given we use the config "encrypted_old.json"
When we run "jrnl -n 1" and enter
"""
Y
bad doggie no biscuit
bad doggie no biscuit
"""
Then we should be prompted for a password
And the output should contain "2013-06-10 15:40 Life is good"
Scenario: Upgrading a config without colors to colors
Given we use the config "no_colors.yaml"
When we run "jrnl -n 1"
Then the config should have "colors" set to
"""
{
'date':'none',
'title':'none',
'body':'none',
'tags':'none'
}
"""
Scenario: Upgrade and parse journals with little endian date format
Given we use the config "upgrade_from_195_little_endian_dates.json"
When we run "jrnl -9" and enter "Y"
Then the journal should have 2 entries
And the output should contain
"""
10.06.2010 15:00 A life without chocolate is like a bad analogy.
"""
And the output should contain
"""
10.06.2013 15:40 He said "[this] is the best time to be alive".
"""
Scenario: Upgrade with missing journal
Given we use the config "upgrade_from_195_with_missing_journal.json"
When we run "jrnl -ls" and enter
""""
Y
"""
Then the output should contain "Error: features/journals/missing.journal does not exist."
And we should get no error
Scenario: Upgrade with missing encrypted journal
Given we use the config "upgrade_from_195_with_missing_encrypted_journal.json"
When we run "jrnl -ls" and enter
"""
Y
bad doggie no biscuit
"""
Then the output should contain "Error: features/journals/missing.journal does not exist."
And the error output should contain "We're all done"
And we should get no error

View file

@ -1,202 +0,0 @@
Feature: Writing new entries.
Scenario Outline: Multiline entry with punctuation should keep title punctuation
Given we use the config "<config_file>.yaml"
And we use the password "bad doggie no biscuit" if prompted
When we run "jrnl This is. the title\\n This is the second line"
And we run "jrnl -n 1"
Then the output should contain "This is. the title"
Examples: configs
| config_file |
| simple |
| empty_folder |
| dayone |
| encrypted |
Scenario Outline: Single line entry with period should be split at period
Given we use the config "<config_file>.yaml"
And we use the password "test" if prompted
When we run "jrnl This is. the title"
And we run "jrnl -1"
Then the output should contain "| the title"
Examples: configs
| config_file |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
Scenario Outline: Writing an entry from command line should store the entry
Given we use the config "<config_file>.yaml"
And we use the password "bad doggie no biscuit" if prompted
When we run "jrnl 23 july 2013: A cold and stormy day. I ate crisps on the sofa."
Then we should see the message "Entry added"
When we run "jrnl -n 1"
Then the output should contain "2013-07-23 09:00 A cold and stormy day."
Examples: configs
| config_file |
| simple |
| empty_folder |
| dayone |
| encrypted |
Scenario Outline: Writing a partial entry from command line with edit flag should go to the editor
Given we use the config "<config_file>.yaml"
And we use the password "test" if prompted
When we run "jrnl this is a partial --edit"
Then we should see the message "Entry added"
Then the editor should have been called
And the editor file content should be
"""
this is a partial
"""
When we run "jrnl -n 1"
Then the output should contain "this is a partial"
Examples: configs
| config_file |
| basic_onefile |
| basic_encrypted |
| basic_dayone |
| basic_folder |
Scenario Outline: Writing an empty entry from the editor should yield "Nothing saved to file" message
Given we use the config "<config_file>.yaml"
And we use the password "test" if prompted
When we open the editor and enter nothing
Then the error output should contain "[Nothing saved to file]"
Examples: configs
| config_file |
| editor |
| editor_empty_folder |
| dayone |
| basic_encrypted |
| basic_onefile |
@skip
Scenario Outline: Writing an empty entry from the command line with no editor should yield nothing
Given we use the config "<config_file>.yaml"
And we use the password "bad doggie no biscuit" if prompted
When we run "jrnl" and enter nothing
Then the output should be empty
And the error output should contain "Writing Entry; on a blank line"
And the editor should not have been called
Examples: configs
| config_file |
| simple |
| empty_folder |
| encrypted |
# | dayone | @todo
Scenario Outline: Writing an entry does not print the entire journal
# https://github.com/jrnl-org/jrnl/issues/87
Given we use the config "<config_file>.yaml"
And we use the password "bad doggie no biscuit" if prompted
When we run "jrnl 23 july 2013: A cold and stormy day. I ate crisps on the sofa."
Then we should see the message "Entry added"
When we run "jrnl -n 1"
Then the output should not contain "Life is good"
Examples: configs
| config_file |
| editor |
| editor_empty_folder |
| dayone |
| encrypted |
Scenario Outline: Embedded period stays in title
Given we use the config "<config_file>.yaml"
And we use the password "bad doggie no biscuit" if prompted
When we run "jrnl 04-24-2014: Created a new website - empty.com. Hope to get a lot of traffic."
Then we should see the message "Entry added"
When we run "jrnl -1"
Then the output should be
"""
2014-04-24 09:00 Created a new website - empty.com.
| Hope to get a lot of traffic.
"""
Examples: configs
| config_file |
| simple |
| empty_folder |
| dayone |
| encrypted |
Scenario Outline: Write and read emoji support
Given we use the config "<config_file>.yaml"
And we use the password "bad doggie no biscuit" if prompted
When we run "jrnl 23 july 2013: 🌞 sunny day. Saw an 🐘"
Then we should see the message "Entry added"
When we run "jrnl -n 1"
Then the output should contain "🌞"
And the output should contain "🐘"
Examples: configs
| config_file |
| simple |
| empty_folder |
| dayone |
| encrypted |
Scenario Outline: Writing an entry at the prompt (no editor) should store the entry
Given we use the config "<config_file>.yaml"
And we use the password "bad doggie no biscuit" if prompted
When we run "jrnl" and enter "25 jul 2013: I saw Elvis. He's alive."
Then we should get no error
When we run "jrnl -on '2013-07-25'"
Then the output should contain "2013-07-25 09:00 I saw Elvis."
And the output should contain "| He's alive."
Examples: configs
| config_file |
| simple |
| empty_folder |
| encrypted |
@todo
Scenario: Writing an entry at the prompt (no editor) in DayOne journal
# Need to test DayOne w/out an editor
Scenario: Writing into Dayone
Given we use the config "dayone.yaml"
When we run "jrnl 01 may 1979: Being born hurts."
And we run "jrnl -until 1980"
Then the output should be "1979-05-01 09:00 Being born hurts."
Scenario: Writing into Dayone adds extended metadata
Given we use the config "dayone.yaml"
When we run "jrnl 01 may 1979: Being born hurts."
And we run "jrnl --export json"
Then "entries" in the json output should have 5 elements
And the json output should contain entries.0.creator.software_agent
And the json output should contain entries.0.creator.os_agent
And the json output should contain entries.0.creator.host_name
And the json output should contain entries.0.creator.generation_date
And the json output should contain entries.0.creator.device_agent
And "entries.0.creator.software_agent" in the json output should contain "jrnl"
# fails when system time is UTC (as on Travis-CI)
@skip
Scenario: Title with an embedded period on DayOne journal
Given we use the config "dayone.yaml"
When we run "jrnl 04-24-2014: "Ran 6.2 miles today in 1:02:03. I'm feeling sore because I forgot to stretch.""
Then we should see the message "Entry added"
When we run "jrnl -1"
Then the output should be
"""
2014-04-24 09:00 Ran 6.2 miles today in 1:02:03.
| I'm feeling sore because I forgot to stretch.
"""
Scenario: Opening an folder that's not a DayOne folder should treat as folder journal
Given we use the config "empty_folder.yaml"
When we run "jrnl 23 july 2013: Testing folder journal."
Then we should see the message "Entry added"
When we run "jrnl -1"
Then the output should be "2013-07-23 09:00 Testing folder journal."

View file

@ -1,203 +0,0 @@
import base64
import getpass
import hashlib
import logging
import os
import sys
from typing import Callable
from typing import Optional
from cryptography.fernet import Fernet
from cryptography.fernet import InvalidToken
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers import algorithms
from cryptography.hazmat.primitives.ciphers import modes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from .Journal import Journal
from .Journal import LegacyJournal
from .prompt import create_password
def make_key(password):
password = password.encode("utf-8")
kdf = PBKDF2HMAC(
algorithm=hashes.SHA256(),
length=32,
# Salt is hard-coded
salt=b"\xf2\xd5q\x0e\xc1\x8d.\xde\xdc\x8e6t\x89\x04\xce\xf8",
iterations=100_000,
backend=default_backend(),
)
key = kdf.derive(password)
return base64.urlsafe_b64encode(key)
def decrypt_content(
decrypt_func: Callable[[str], Optional[str]],
keychain: str = None,
max_attempts: int = 3,
) -> str:
pwd_from_keychain = keychain and get_keychain(keychain)
password = pwd_from_keychain or getpass.getpass()
result = decrypt_func(password)
# Password is bad:
if result is None and pwd_from_keychain:
set_keychain(keychain, None)
attempt = 1
while result is None and attempt < max_attempts:
print("Wrong password, try again.", file=sys.stderr)
password = getpass.getpass()
result = decrypt_func(password)
attempt += 1
if result is not None:
return result
else:
print("Extremely wrong password.", file=sys.stderr)
sys.exit(1)
class EncryptedJournal(Journal):
def __init__(self, name="default", **kwargs):
super().__init__(name, **kwargs)
self.config["encrypt"] = True
self.password = None
def open(self, filename=None):
"""Opens the journal file defined in the config and parses it into a list of Entries.
Entries have the form (date, title, body)."""
filename = filename or self.config["journal"]
dirname = os.path.dirname(filename)
if not os.path.exists(filename):
if not os.path.isdir(dirname):
os.makedirs(dirname)
print(f"[Directory {dirname} created]", file=sys.stderr)
self.create_file(filename)
self.password = create_password(self.name)
print(
f"Encrypted journal '{self.name}' created at {filename}",
file=sys.stderr,
)
text = self._load(filename)
self.entries = self._parse(text)
self.sort()
logging.debug("opened %s with %d entries", self.__class__.__name__, len(self))
return self
def _load(self, filename):
"""Loads an encrypted journal from a file and tries to decrypt it.
If password is not provided, will look for password in the keychain
and otherwise ask the user to enter a password up to three times.
If the password is provided but wrong (or corrupt), this will simply
return None."""
with open(filename, "rb") as f:
journal_encrypted = f.read()
def decrypt_journal(password):
key = make_key(password)
try:
plain = Fernet(key).decrypt(journal_encrypted).decode("utf-8")
self.password = password
return plain
except (InvalidToken, IndexError):
return None
if self.password:
return decrypt_journal(self.password)
return decrypt_content(keychain=self.name, decrypt_func=decrypt_journal)
def _store(self, filename, text):
key = make_key(self.password)
journal = Fernet(key).encrypt(text.encode("utf-8"))
with open(filename, "wb") as f:
f.write(journal)
@classmethod
def from_journal(cls, other: Journal):
new_journal = super().from_journal(other)
try:
new_journal.password = (
other.password
if hasattr(other, "password")
else create_password(other.name)
)
except KeyboardInterrupt:
print("[Interrupted while creating new journal]", file=sys.stderr)
sys.exit(1)
return new_journal
class LegacyEncryptedJournal(LegacyJournal):
"""Legacy class to support opening journals encrypted with the jrnl 1.x
standard. You'll not be able to save these journals anymore."""
def __init__(self, name="default", **kwargs):
super().__init__(name, **kwargs)
self.config["encrypt"] = True
self.password = None
def _load(self, filename):
with open(filename, "rb") as f:
journal_encrypted = f.read()
iv, cipher = journal_encrypted[:16], journal_encrypted[16:]
def decrypt_journal(password):
decryption_key = hashlib.sha256(password.encode("utf-8")).digest()
decryptor = Cipher(
algorithms.AES(decryption_key), modes.CBC(iv), default_backend()
).decryptor()
try:
plain_padded = decryptor.update(cipher) + decryptor.finalize()
self.password = password
if plain_padded[-1] in (" ", 32):
# Ancient versions of jrnl. Do not judge me.
return plain_padded.decode("utf-8").rstrip(" ")
else:
unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder()
plain = unpadder.update(plain_padded) + unpadder.finalize()
return plain.decode("utf-8")
except ValueError:
return None
if self.password:
return decrypt_journal(self.password)
return decrypt_content(keychain=self.name, decrypt_func=decrypt_journal)
def get_keychain(journal_name):
import keyring
try:
return keyring.get_password("jrnl", journal_name)
except keyring.errors.KeyringError as e:
if not isinstance(e, keyring.errors.NoKeyringError):
print("Failed to retrieve keyring", file=sys.stderr)
return ""
def set_keychain(journal_name, password):
import keyring
if password is None:
try:
keyring.delete_password("jrnl", journal_name)
except keyring.errors.KeyringError:
pass
else:
try:
keyring.set_password("jrnl", journal_name, password)
except keyring.errors.KeyringError as e:
if isinstance(e, keyring.errors.NoKeyringError):
print(
"Keyring backend not found. Please install one of the supported backends by visiting: https://pypi.org/project/keyring/",
file=sys.stderr,
)
else:
print("Failed to retrieve keyring", file=sys.stderr)

View file

@ -1,95 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import codecs
import fnmatch
import os
from . import Journal
def get_files(journal_config):
"""Searches through sub directories starting with journal_config and find all text files"""
filenames = []
for root, dirnames, f in os.walk(journal_config):
for filename in fnmatch.filter(f, "*.txt"):
filenames.append(os.path.join(root, filename))
return filenames
class Folder(Journal.Journal):
"""A Journal handling multiple files in a folder"""
def __init__(self, **kwargs):
self.entries = []
self._diff_entry_dates = []
super(Folder, self).__init__(**kwargs)
def open(self):
filenames = []
self.entries = []
filenames = get_files(self.config["journal"])
for filename in filenames:
with codecs.open(filename, "r", "utf-8") as f:
journal = f.read()
self.entries.extend(self._parse(journal))
self.sort()
return self
def write(self):
"""Writes only the entries that have been modified into proper files."""
# Create a list of dates of modified entries. Start with diff_entry_dates
modified_dates = self._diff_entry_dates
seen_dates = set(self._diff_entry_dates)
for e in self.entries:
if e.modified:
if e.date not in seen_dates:
modified_dates.append(e.date)
seen_dates.add(e.date)
# For every date that had a modified entry, write to a file
for d in modified_dates:
write_entries = []
filename = os.path.join(
self.config["journal"],
d.strftime("%Y"),
d.strftime("%m"),
d.strftime("%d") + ".txt",
)
dirname = os.path.dirname(filename)
# create directory if it doesn't exist
if not os.path.exists(dirname):
os.makedirs(dirname)
for e in self.entries:
if (
e.date.year == d.year
and e.date.month == d.month
and e.date.day == d.day
):
write_entries.append(e)
journal = "\n".join([e.__str__() for e in write_entries])
with codecs.open(filename, "w", "utf-8") as journal_file:
journal_file.write(journal)
# look for and delete empty files
filenames = []
filenames = get_files(self.config["journal"])
for filename in filenames:
if os.stat(filename).st_size <= 0:
# print("empty file: {}".format(filename))
os.remove(filename)
def parse_editable_str(self, edited):
"""Parses the output of self.editable_str and updates it's entries."""
mod_entries = self._parse(edited)
diff_entries = set(self.entries) - set(mod_entries)
for e in diff_entries:
self._diff_entry_dates.append(e.date)
# Match those entries that can be found in self.entries and set
# these to modified, so we can get a count of how many entries got
# modified and how many got deleted later.
for entry in mod_entries:
entry.modified = not any(entry == old_entry for old_entry in self.entries)
self.entries = mod_entries

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python # Copyright © 2012-2023 jrnl contributors
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
try: try:
from .__version__ import __version__ from jrnl.__version__ import __version__
except ImportError: except ImportError:
__version__ = "source" __version__ = "source"
__title__ = "jrnl" __title__ = "jrnl"

View file

@ -1,10 +1,9 @@
#!/usr/bin/env python # Copyright © 2012-2023 jrnl contributors
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import sys import sys
from .cli import cli from jrnl.main import run
if __name__ == "__main__": if __name__ == "__main__":
sys.exit(cli()) sys.exit(run())

View file

@ -1 +1 @@
__version__ = "v2.7" __version__ = "v4.2.1"

View file

@ -1,26 +1,26 @@
# Copyright (C) 2012-2021 jrnl contributors # Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import argparse import argparse
import re import re
import textwrap import textwrap
from .commands import postconfig_decrypt from jrnl.commands import postconfig_decrypt
from .commands import postconfig_encrypt from jrnl.commands import postconfig_encrypt
from .commands import postconfig_import from jrnl.commands import postconfig_import
from .commands import postconfig_list from jrnl.commands import postconfig_list
from .commands import preconfig_diagnostic from jrnl.commands import preconfig_diagnostic
from .commands import preconfig_version from jrnl.commands import preconfig_version
from .output import deprecated_cmd from jrnl.output import deprecated_cmd
from .plugins import EXPORT_FORMATS from jrnl.plugins import EXPORT_FORMATS
from .plugins import IMPORT_FORMATS from jrnl.plugins import IMPORT_FORMATS
from .plugins import util from jrnl.plugins import util
class WrappingFormatter(argparse.RawTextHelpFormatter): class WrappingFormatter(argparse.RawTextHelpFormatter):
"""Used in help screen""" """Used in help screen"""
def _split_lines(self, text, width): def _split_lines(self, text: str, width: int) -> list[str]:
text = text.split("\n\n") text = text.split("\n\n")
text = map(lambda t: self._whitespace_matcher.sub(" ", t).strip(), text) text = map(lambda t: self._whitespace_matcher.sub(" ", t).strip(), text)
text = map(lambda t: textwrap.wrap(t, width=56), text) text = map(lambda t: textwrap.wrap(t, width=56), text)
@ -28,7 +28,44 @@ class WrappingFormatter(argparse.RawTextHelpFormatter):
return text return text
def parse_args(args=[]): class IgnoreNoneAppendAction(argparse._AppendAction):
"""
Pass -not without a following string and avoid appending
a None value to the excluded list
"""
def __call__(self, parser, namespace, values, option_string=None):
if values is not None:
super().__call__(parser, namespace, values, option_string)
def parse_not_arg(
args: list[str], parsed_args: argparse.Namespace, parser: argparse.ArgumentParser
) -> argparse.Namespace:
"""
It's possible to use -not as a precursor to -starred and -tagged
to reverse their behaviour, however this requires some extra logic
to parse, and to ensure we still do not allow passing an empty -not
"""
parsed_args.exclude_starred = False
parsed_args.exclude_tagged = False
if "-not-starred" in "".join(args):
parsed_args.starred = False
parsed_args.exclude_starred = True
if "-not-tagged" in "".join(args):
parsed_args.tagged = False
parsed_args.exclude_tagged = True
if "-not" in args and not any(
[parsed_args.exclude_starred, parsed_args.exclude_tagged, parsed_args.excluded]
):
parser.error("argument -not: expected 1 argument")
return parsed_args
def parse_args(args: list[str] = []) -> argparse.Namespace:
""" """
Argument parsing that is doable before the config is available. Argument parsing that is doable before the config is available.
Everything else goes into "text" for later parsing. Everything else goes into "text" for later parsing.
@ -39,9 +76,9 @@ def parse_args(args=[]):
description="Collect your thoughts and notes without leaving the command line", description="Collect your thoughts and notes without leaving the command line",
epilog=textwrap.dedent( epilog=textwrap.dedent(
""" """
Thank you to all of our contributors! Come see the whole list of code and We gratefully thank all contributors!
financial contributors at https://github.com/jrnl-org/jrnl. And special Come see the whole list of code and financial contributors at https://github.com/jrnl-org/jrnl
thanks to Bad Lip Reading for the Yoda joke in the Writing section above.""" And special thanks to Bad Lip Reading for the Yoda joke in the Writing section above :)""" # noqa: E501
), ),
) )
@ -85,7 +122,13 @@ def parse_args(args=[]):
action="store_const", action="store_const",
const=postconfig_list, const=postconfig_list,
dest="postconfig_cmd", dest="postconfig_cmd",
help="List all configured journals", help="""
List all configured journals.
Optional parameters:
--format [json or yaml]
""",
) )
standalone.add_argument( standalone.add_argument(
"--ls", "--ls",
@ -168,6 +211,12 @@ def parse_args(args=[]):
"Writing", textwrap.dedent(compose_msg).strip() "Writing", textwrap.dedent(compose_msg).strip()
) )
composing.add_argument("text", metavar="", nargs="*") composing.add_argument("text", metavar="", nargs="*")
composing.add_argument(
"--template",
dest="template",
help="Path to template file. Can be a local path, absolute path, or a path "
"relative to $XDG_DATA_HOME/jrnl/templates/",
)
read_msg = ( read_msg = (
"To find entries from your journal, use any combination of the below filters." "To find entries from your journal, use any combination of the below filters."
@ -216,14 +265,17 @@ def parse_args(args=[]):
reading.add_argument( reading.add_argument(
"-contains", "-contains",
dest="contains", dest="contains",
action="append",
metavar="TEXT", metavar="TEXT",
help="Show entries containing specific text (put quotes around text with spaces)", help="Show entries containing specific text (put quotes around text with "
"spaces)",
) )
reading.add_argument( reading.add_argument(
"-and", "-and",
dest="strict", dest="strict",
action="store_true", action="store_true",
help='Show only entries that match all conditions, like saying "x AND y" (default: OR)', help='Show only entries that match all conditions, like saying "x AND y" '
"(default: OR)",
) )
reading.add_argument( reading.add_argument(
"-starred", "-starred",
@ -231,12 +283,19 @@ def parse_args(args=[]):
action="store_true", action="store_true",
help="Show only starred entries (marked with *)", help="Show only starred entries (marked with *)",
) )
reading.add_argument(
"-tagged",
dest="tagged",
action="store_true",
help="Show only entries that have at least one tag",
)
reading.add_argument( reading.add_argument(
"-n", "-n",
dest="limit", dest="limit",
default=None, default=None,
metavar="NUMBER", metavar="NUMBER",
help="Show a maximum of NUMBER entries (note: '-n 3' and '-3' have the same effect)", help="Show a maximum of NUMBER entries (note: '-n 3' and '-3' have the same "
"effect)",
nargs="?", nargs="?",
type=int, type=int,
) )
@ -245,13 +304,21 @@ def parse_args(args=[]):
dest="excluded", dest="excluded",
nargs="?", nargs="?",
default=[], default=[],
metavar="TAG", metavar="TAG/FLAG",
action="append", action=IgnoreNoneAppendAction,
help="Exclude entries with this tag", help=(
"If passed a string, will exclude entries with that tag. "
"Can be also used before -starred or -tagged flags, to exclude "
"starred or tagged entries respectively."
),
) )
search_options_msg = """ These help you do various tasks with the selected entries from your search. search_options_msg = (
" " # Preserves indentation
"""
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""" If used on their own (with no search), they will act on your entire journal"""
)
exporting = parser.add_argument_group( exporting = parser.add_argument_group(
"Searching Options", textwrap.dedent(search_options_msg) "Searching Options", textwrap.dedent(search_options_msg)
) )
@ -267,6 +334,14 @@ def parse_args(args=[]):
action="store_true", action="store_true",
help="Interactively deletes selected entries", help="Interactively deletes selected entries",
) )
exporting.add_argument(
"--change-time",
dest="change_time",
nargs="?",
metavar="DATE",
const="now",
help="Change timestamp for selected entries (default: now)",
)
exporting.add_argument( exporting.add_argument(
"--format", "--format",
metavar="TYPE", metavar="TYPE",
@ -294,7 +369,8 @@ def parse_args(args=[]):
"--tags", "--tags",
dest="tags", dest="tags",
action="store_true", action="store_true",
help="Alias for '--format tags'. Returns a list of all tags and number of occurences", help="Alias for '--format tags'. Returns a list of all tags and number of "
"occurrences",
) )
exporting.add_argument( exporting.add_argument(
"--short", "--short",
@ -314,8 +390,67 @@ def parse_args(args=[]):
help=argparse.SUPPRESS, help=argparse.SUPPRESS,
) )
config_overrides = parser.add_argument_group(
"Config file override",
textwrap.dedent("Apply a one-off override of the config file option"),
)
config_overrides.add_argument(
"--config-override",
dest="config_override",
action="append",
type=str,
nargs=2,
default=[],
metavar="CONFIG_KV_PAIR",
help="""
Override configured key-value pair with CONFIG_KV_PAIR for this command invocation only.
Examples: \n
\t - Use a different editor for this jrnl entry, call: \n
\t jrnl --config-override editor "nano" \n
\t - Override color selections\n
\t jrnl --config-override colors.body blue --config-override colors.title green
""", # noqa: E501
)
config_overrides.add_argument(
"--co",
dest="config_override",
action="append",
type=str,
nargs=2,
default=[],
help=argparse.SUPPRESS,
)
alternate_config = parser.add_argument_group(
"Specifies alternate config to be used",
textwrap.dedent("Applies alternate config for current session"),
)
alternate_config.add_argument(
"--config-file",
dest="config_file_path",
type=str,
default="",
help="""
Overrides default (created when first installed) config file for this command only.
Examples: \n
\t - Use a work config file for this jrnl entry, call: \n
\t jrnl --config-file /home/user1/work_config.yaml
\t - Use a personal config file stored on a thumb drive: \n
\t jrnl --config-file /media/user1/my-thumb-drive/personal_config.yaml
""", # noqa: E501
)
alternate_config.add_argument(
"--cf", dest="config_file_path", type=str, default="", help=argparse.SUPPRESS
)
# Handle '-123' as a shortcut for '-n 123' # Handle '-123' as a shortcut for '-n 123'
num = re.compile(r"^-(\d+)$") num = re.compile(r"^-(\d+)$")
args = [num.sub(r"-n \1", arg) for arg in args] args = [num.sub(r"-n \1", arg) for arg in args]
parsed_args = parser.parse_intermixed_args(args)
parsed_args = parse_not_arg(args, parsed_args, parser)
return parser.parse_intermixed_args(args) return parsed_args

View file

@ -1,42 +0,0 @@
#!/usr/bin/env python
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import logging
import sys
from .jrnl import run
from .args import parse_args
from .exception import JrnlError
def configure_logger(debug=False):
if not debug:
logging.disable()
return
logging.basicConfig(
level=logging.DEBUG,
format="%(levelname)-8s %(name)-12s %(message)s",
)
logging.getLogger("parsedatetime").setLevel(logging.INFO)
logging.getLogger("keyring.backend").setLevel(logging.ERROR)
def cli(manual_args=None):
try:
if manual_args is None:
manual_args = sys.argv[1:]
args = parse_args(manual_args)
configure_logger(args.debug)
logging.debug("Parsed args: %s", args)
return run(args)
except JrnlError as e:
print(e.message, file=sys.stderr)
return 1
except KeyboardInterrupt:
return 1

View file

@ -1,21 +1,23 @@
#!/usr/bin/env python # Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import re import re
from string import punctuation from string import punctuation
from string import whitespace from string import whitespace
from typing import TYPE_CHECKING
import colorama import colorama
from .os_compat import on_windows from jrnl.os_compat import on_windows
if TYPE_CHECKING:
from jrnl.journals import Entry
if on_windows(): if on_windows():
colorama.init() colorama.init()
WARNING_COLOR = colorama.Fore.YELLOW
ERROR_COLOR = colorama.Fore.RED
RESET_COLOR = colorama.Fore.RESET
def colorize(string: str, color: str, bold: bool = False) -> str:
def colorize(string, color, bold=False):
"""Returns the string colored with colorama.Fore.color. If the color set by """Returns the string colored with colorama.Fore.color. If the color set by
the user is "NONE" or the color doesn't exist in the colorama.Fore attributes, the user is "NONE" or the color doesn't exist in the colorama.Fore attributes,
it returns the string without any modification.""" it returns the string without any modification."""
@ -28,7 +30,9 @@ def colorize(string, color, bold=False):
return colorama.Style.BRIGHT + color_escape + string + colorama.Style.RESET_ALL return colorama.Style.BRIGHT + color_escape + string + colorama.Style.RESET_ALL
def highlight_tags_with_background_color(entry, text, color, is_title=False): def highlight_tags_with_background_color(
entry: "Entry", text: str, color: str, is_title: bool = False
) -> str:
""" """
Takes a string and colorizes the tags in it based upon the config value for Takes a string and colorizes the tags in it based upon the config value for
color.tags, while colorizing the rest of the text based on `color`. color.tags, while colorizing the rest of the text based on `color`.
@ -47,9 +51,9 @@ def highlight_tags_with_background_color(entry, text, color, is_title=False):
:returns [(colorized_str, original_str)]""" :returns [(colorized_str, original_str)]"""
for part in fragments: for part in fragments:
if part and part[0] not in config["tagsymbols"]: if part and part[0] not in config["tagsymbols"]:
yield (colorize(part, color, bold=is_title), part) yield colorize(part, color, bold=is_title), part
elif part: elif part:
yield (colorize(part, config["colors"]["tags"], bold=True), part) yield colorize(part, config["colors"]["tags"], bold=True), part
config = entry.journal.config config = entry.journal.config
if config["highlight"]: # highlight tags if config["highlight"]: # highlight tags

View file

@ -1,3 +1,6 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
""" """
Functions in this file are standalone commands. All standalone commands are split into Functions in this file are standalone commands. All standalone commands are split into
two categories depending on whether they require the config to be loaded to be able to two categories depending on whether they require the config to be loaded to be able to
@ -11,71 +14,128 @@ run.
Also, please note that all (non-builtin) imports should be scoped to each function to Also, please note that all (non-builtin) imports should be scoped to each function to
avoid any possible overhead for these standalone commands. avoid any possible overhead for these standalone commands.
""" """
import argparse
import logging
import platform import platform
import sys import sys
from jrnl.config import cmd_requires_valid_journal_name
from jrnl.exception import JrnlException
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
from jrnl.output import print_msg
def preconfig_diagnostic(_):
def preconfig_diagnostic(_) -> None:
from jrnl import __title__
from jrnl import __version__ from jrnl import __version__
print( print(
f"jrnl: {__version__}\n" f"{__title__}: {__version__}\n"
f"Python: {sys.version}\n" f"Python: {sys.version}\n"
f"OS: {platform.system()} {platform.release()}" f"OS: {platform.system()} {platform.release()}"
) )
def preconfig_version(_): def preconfig_version(_) -> None:
import textwrap
from jrnl import __title__ from jrnl import __title__
from jrnl import __version__ from jrnl import __version__
version_str = f"""{__title__} version {__version__} output = f"""
{__title__} {__version__}
Copyright (C) 2012-2021 jrnl contributors Copyright © 2012-2023 jrnl contributors
This is free software, and you are welcome to redistribute it under certain This is free software, and you are welcome to redistribute it under certain
conditions; for details, see: https://www.gnu.org/licenses/gpl-3.0.html""" conditions; for details, see: https://www.gnu.org/licenses/gpl-3.0.html
"""
print(version_str) output = textwrap.dedent(output).strip()
print(output)
def postconfig_list(config, **kwargs): def postconfig_list(args: argparse.Namespace, config: dict, **_) -> int:
from .output import list_journals from jrnl.output import list_journals
print(list_journals(config)) print(list_journals(config, args.export))
return 0
def postconfig_import(args, config, **kwargs): @cmd_requires_valid_journal_name
from .Journal import open_journal def postconfig_import(args: argparse.Namespace, config: dict, **_) -> int:
from .plugins import get_importer from jrnl.journals import open_journal
from jrnl.plugins import get_importer
# Requires opening the journal # Requires opening the journal
journal = open_journal(args.journal_name, config) journal = open_journal(args.journal_name, config)
format = args.export if args.export else "jrnl" format = args.export if args.export else "jrnl"
get_importer(format).import_(journal, args.filename)
if (importer := get_importer(format)) is None:
raise JrnlException(
Message(
MsgText.ImporterNotFound,
MsgStyle.ERROR,
{"format": format},
)
)
importer.import_(journal, args.filename)
return 0
def postconfig_encrypt(args, config, original_config, **kwargs): @cmd_requires_valid_journal_name
def postconfig_encrypt(
args: argparse.Namespace, config: dict, original_config: dict
) -> int:
""" """
Encrypt a journal in place, or optionally to a new file Encrypt a journal in place, or optionally to a new file
""" """
from .EncryptedJournal import EncryptedJournal from jrnl.config import update_config
from .Journal import open_journal from jrnl.install import save_config
from .config import update_config from jrnl.journals import open_journal
from .install import save_config
# Open the journal # Open the journal
journal = open_journal(args.journal_name, config) journal = open_journal(args.journal_name, config)
if hasattr(journal, "can_be_encrypted") and not journal.can_be_encrypted:
raise JrnlException(
Message(
MsgText.CannotEncryptJournalType,
MsgStyle.ERROR,
{
"journal_name": args.journal_name,
"journal_type": journal.__class__.__name__,
},
)
)
# If journal is encrypted, create new password
logging.debug("Clearing encryption method...")
if journal.config["encrypt"] is True:
logging.debug("Journal already encrypted. Re-encrypting...")
print(f"Journal {journal.name} is already encrypted. Create a new password.")
journal.encryption_method.clear()
else:
journal.config["encrypt"] = True journal.config["encrypt"] = True
journal.encryption_method = None
new_journal = EncryptedJournal.from_journal(journal) journal.write(args.filename)
new_journal.write(args.filename)
print( print_msg(
f"Journal encrypted to {args.filename or new_journal.config['journal']}.", Message(
file=sys.stderr, MsgText.JournalEncryptedTo,
MsgStyle.NORMAL,
{"path": args.filename or journal.config["journal"]},
)
) )
# Update the config, if we encrypted in place # Update the config, if we encrypted in place
@ -85,22 +145,31 @@ def postconfig_encrypt(args, config, original_config, **kwargs):
) )
save_config(original_config) save_config(original_config)
return 0
def postconfig_decrypt(args, config, original_config, **kwargs):
""" Decrypts into new file. If filename is not set, we encrypt the journal file itself. """ @cmd_requires_valid_journal_name
from .Journal import PlainJournal def postconfig_decrypt(
from .Journal import open_journal args: argparse.Namespace, config: dict, original_config: dict
from .config import update_config ) -> int:
from .install import save_config """Decrypts to file. If filename is not set, we encrypt the journal file itself."""
from jrnl.config import update_config
from jrnl.install import save_config
from jrnl.journals import open_journal
journal = open_journal(args.journal_name, config) journal = open_journal(args.journal_name, config)
journal.config["encrypt"] = False
new_journal = PlainJournal.from_journal(journal) logging.debug("Clearing encryption method...")
new_journal.write(args.filename) journal.config["encrypt"] = False
print( journal.encryption_method = None
f"Journal decrypted to {args.filename or new_journal.config['journal']}.",
file=sys.stderr, journal.write(args.filename)
print_msg(
Message(
MsgText.JournalDecryptedTo,
MsgStyle.NORMAL,
{"path": args.filename or journal.config["journal"]},
)
) )
# Update the config, if we decrypted in place # Update the config, if we decrypted in place
@ -109,3 +178,5 @@ def postconfig_decrypt(args, config, original_config, **kwargs):
original_config, {"encrypt": False}, args.journal_name, force_local=True original_config, {"encrypt": False}, args.journal_name, force_local=True
) )
save_config(original_config) save_config(original_config)
return 0

View file

@ -1,96 +1,127 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import argparse
import logging import logging
import os import os
import sys from typing import Any
from typing import Callable
import colorama import colorama
import yaml from rich.pretty import pretty_repr
import xdg.BaseDirectory from ruamel.yaml import YAML
from ruamel.yaml import constructor
from . import __version__ from jrnl import __version__
from .exception import JrnlError from jrnl.exception import JrnlException
from .color import ERROR_COLOR from jrnl.messages import Message
from .color import RESET_COLOR from jrnl.messages import MsgStyle
from .output import list_journals from jrnl.messages import MsgText
from jrnl.output import list_journals
from jrnl.output import print_msg
from jrnl.path import get_config_path
from jrnl.path import get_default_journal_path
# Constants # Constants
DEFAULT_CONFIG_NAME = "jrnl.yaml"
XDG_RESOURCE = "jrnl"
DEFAULT_JOURNAL_NAME = "journal.txt"
DEFAULT_JOURNAL_KEY = "default" DEFAULT_JOURNAL_KEY = "default"
YAML_SEPARATOR = ": "
YAML_FILE_ENCODING = "utf-8"
def save_config(config):
def make_yaml_valid_dict(input: list) -> dict:
"""
Convert a two-element list of configuration key-value pair into a flat dict.
The dict is created through the yaml loader, with the assumption that
"input[0]: input[1]" is valid yaml.
:param input: list of configuration keys in dot-notation and their respective values
:type input: list
:return: A single level dict of the configuration keys in dot-notation and their
respective desired values
:rtype: dict
"""
assert len(input) == 2
# yaml compatible strings are of the form Key:Value
yamlstr = YAML_SEPARATOR.join(input)
runtime_modifications = YAML(typ="safe").load(yamlstr)
return runtime_modifications
def save_config(config: dict, alt_config_path: str | None = None) -> None:
"""Supply alt_config_path if using an alternate config through --config-file."""
config["version"] = __version__ config["version"] = __version__
with open(get_config_path(), "w") as f:
yaml.safe_dump( yaml = YAML(typ="safe")
config, f, encoding="utf-8", allow_unicode=True, default_flow_style=False yaml.default_flow_style = False # prevents collapsing of tree structure
)
with open(
alt_config_path if alt_config_path else get_config_path(),
"w",
encoding=YAML_FILE_ENCODING,
) as f:
yaml.dump(config, f)
def get_config_path(): def get_default_config() -> dict[str, Any]:
try:
config_directory_path = xdg.BaseDirectory.save_config_path(XDG_RESOURCE)
except FileExistsError:
raise JrnlError(
"ConfigDirectoryIsFile",
config_directory_path=os.path.join(
xdg.BaseDirectory.xdg_config_home, XDG_RESOURCE
),
)
return os.path.join(
config_directory_path or os.path.expanduser("~"), DEFAULT_CONFIG_NAME
)
def get_default_config():
return { return {
"version": __version__, "version": __version__,
"journals": {"default": get_default_journal_path()}, "journals": {"default": {"journal": get_default_journal_path()}},
"editor": os.getenv("VISUAL") or os.getenv("EDITOR") or "", "editor": os.getenv("VISUAL") or os.getenv("EDITOR") or "",
"encrypt": False, "encrypt": False,
"template": False, "template": False,
"default_hour": 9, "default_hour": 9,
"default_minute": 0, "default_minute": 0,
"timeformat": "%Y-%m-%d %H:%M", "timeformat": "%F %r",
"tagsymbols": "@", "tagsymbols": "#@",
"highlight": True, "highlight": True,
"linewrap": 79, "linewrap": 79,
"indent_character": "|", "indent_character": "|",
"colors": { "colors": {
"date": "none",
"title": "none",
"body": "none", "body": "none",
"date": "none",
"tags": "none", "tags": "none",
"title": "none",
}, },
} }
def get_default_journal_path(): def get_default_colors() -> dict[str, Any]:
journal_data_path = xdg.BaseDirectory.save_data_path( return {
XDG_RESOURCE "body": "none",
) or os.path.expanduser("~") "date": "black",
return os.path.join(journal_data_path, DEFAULT_JOURNAL_NAME) "tags": "yellow",
"title": "cyan",
}
def scope_config(config, journal_name): def scope_config(config: dict, journal_name: str) -> dict:
if journal_name not in config["journals"]: if journal_name not in config["journals"]:
return config return config
config = config.copy() config = config.copy()
journal_conf = config["journals"].get(journal_name) journal_conf = config["journals"].get(journal_name)
if type(journal_conf) is dict: if isinstance(journal_conf, dict):
# We can override the default config on a by-journal basis # We can override the default config on a by-journal basis
logging.debug( logging.debug(
"Updating configuration with specific journal overrides %s", journal_conf "Updating configuration with specific journal overrides:\n%s",
pretty_repr(journal_conf),
) )
config.update(journal_conf) config.update(journal_conf)
else: else:
# But also just give them a string to point to the journal file # But also just give them a string to point to the journal file
config["journal"] = journal_conf config["journal"] = journal_conf
logging.debug("Scoped config:\n%s", pretty_repr(config))
return config return config
def verify_config_colors(config): def verify_config_colors(config: dict) -> bool:
""" """
Ensures the keys set for colors are valid colorama.Fore attributes, or "None" Ensures the keys set for colors are valid colorama.Fore attributes, or "None"
:return: True if all keys are set correctly, False otherwise :return: True if all keys are set correctly, False otherwise
@ -101,33 +132,56 @@ def verify_config_colors(config):
if upper_color == "NONE": if upper_color == "NONE":
continue continue
if not getattr(colorama.Fore, upper_color, None): if not getattr(colorama.Fore, upper_color, None):
print( print_msg(
"[{2}ERROR{3}: {0} set to invalid color: {1}]".format( Message(
key, color, ERROR_COLOR, RESET_COLOR MsgText.InvalidColor,
), MsgStyle.NORMAL,
file=sys.stderr, {
"key": key,
"color": color,
},
)
) )
all_valid_colors = False all_valid_colors = False
return all_valid_colors return all_valid_colors
def load_config(config_path): def load_config(config_path: str) -> dict:
"""Tries to load a config file from YAML.""" """Tries to load a config file from YAML."""
with open(config_path) as f: try:
return yaml.load(f, Loader=yaml.FullLoader) with open(config_path, encoding=YAML_FILE_ENCODING) as f:
yaml = YAML(typ="safe")
yaml.allow_duplicate_keys = False
return yaml.load(f)
except constructor.DuplicateKeyError as e:
print_msg(
Message(
MsgText.ConfigDoubleKeys,
MsgStyle.WARNING,
{
"error_message": e,
},
)
)
with open(config_path, encoding=YAML_FILE_ENCODING) as f:
yaml = YAML(typ="safe")
yaml.allow_duplicate_keys = True
return yaml.load(f)
def is_config_json(config_path): def is_config_json(config_path: str) -> bool:
with open(config_path, "r", encoding="utf-8") as f: with open(config_path, "r", encoding="utf-8") as f:
config_file = f.read() config_file = f.read()
return config_file.strip().startswith("{") return config_file.strip().startswith("{")
def update_config(config, new_config, scope, force_local=False): def update_config(
config: dict, new_config: dict, scope: str | None, force_local: bool = False
) -> None:
"""Updates a config dict with new values - either global if scope is None """Updates a config dict with new values - either global if scope is None
or config['journals'][scope] is just a string pointing to a journal file, or config['journals'][scope] is just a string pointing to a journal file,
or within the scope""" or within the scope"""
if scope and type(config["journals"][scope]) is dict: # Update to journal specific if scope and isinstance(config["journals"][scope], dict):
config["journals"][scope].update(new_config) config["journals"][scope].update(new_config)
elif scope and force_local: # Convert to dict elif scope and force_local: # Convert to dict
config["journals"][scope] = {"journal": config["journals"][scope]} config["journals"][scope] = {"journal": config["journals"][scope]}
@ -136,15 +190,40 @@ def update_config(config, new_config, scope, force_local=False):
config.update(new_config) config.update(new_config)
def get_journal_name(args, config): def get_journal_name(args: argparse.Namespace, config: dict) -> argparse.Namespace:
args.journal_name = DEFAULT_JOURNAL_KEY args.journal_name = DEFAULT_JOURNAL_KEY
if args.text and args.text[0] in config["journals"]:
args.journal_name = args.text[0] # The first arg might be a journal name
if args.text:
potential_journal_name = args.text[0]
if potential_journal_name[-1] == ":":
potential_journal_name = potential_journal_name[0:-1]
if potential_journal_name in config["journals"]:
args.journal_name = potential_journal_name
args.text = args.text[1:] args.text = args.text[1:]
elif DEFAULT_JOURNAL_KEY not in config["journals"]:
print("No default journal configured.", file=sys.stderr)
print(list_journals(config), file=sys.stderr)
sys.exit(1)
logging.debug("Using journal name: %s", args.journal_name) logging.debug("Using journal name: %s", args.journal_name)
return args return args
def cmd_requires_valid_journal_name(func: Callable) -> Callable:
def wrapper(args: argparse.Namespace, config: dict, original_config: dict):
validate_journal_name(args.journal_name, config)
func(args=args, config=config, original_config=original_config)
return wrapper
def validate_journal_name(journal_name: str, config: dict) -> None:
if journal_name not in config["journals"]:
raise JrnlException(
Message(
MsgText.NoNamedJournal,
MsgStyle.ERROR,
{
"journal_name": journal_name,
"journals": list_journals(config),
},
),
)

455
jrnl/controller.py Normal file
View file

@ -0,0 +1,455 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import logging
import sys
from typing import TYPE_CHECKING
from jrnl import install
from jrnl import plugins
from jrnl import time
from jrnl.config import DEFAULT_JOURNAL_KEY
from jrnl.config import get_config_path
from jrnl.config import get_journal_name
from jrnl.config import scope_config
from jrnl.editor import get_text_from_editor
from jrnl.editor import get_text_from_stdin
from jrnl.editor import read_template_file
from jrnl.exception import JrnlException
from jrnl.journals import open_journal
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
from jrnl.output import print_msg
from jrnl.output import print_msgs
from jrnl.override import apply_overrides
if TYPE_CHECKING:
from argparse import Namespace
from jrnl.journals import Entry
from jrnl.journals import Journal
def run(args: "Namespace"):
"""
Flow:
1. Run standalone command if it doesn't need config (help, version, etc), then exit
2. Load config
3. Run standalone command if it does need config (encrypt, decrypt, etc), then exit
4. Load specified journal
5. Start append mode, or search mode
6. Perform actions with results from search mode (if needed)
7. Profit
"""
# Run command if possible before config is available
if callable(args.preconfig_cmd):
return args.preconfig_cmd(args)
# Load the config, and extract journal name
config = install.load_or_install_jrnl(args.config_file_path)
original_config = config.copy()
# Apply config overrides
config = apply_overrides(args, config)
args = get_journal_name(args, config)
config = scope_config(config, args.journal_name)
# Run post-config command now that config is ready
if callable(args.postconfig_cmd):
return args.postconfig_cmd(
args=args, config=config, original_config=original_config
)
# --- All the standalone commands are now done --- #
# Get the journal we're going to be working with
journal = open_journal(args.journal_name, config)
kwargs = {
"args": args,
"config": config,
"journal": journal,
"old_entries": journal.entries,
}
if _is_append_mode(**kwargs):
append_mode(**kwargs)
return
# If not append mode, then we're in search mode (only 2 modes exist)
search_mode(**kwargs)
entries_found_count = len(journal)
_print_entries_found_count(entries_found_count, args)
# Actions
_perform_actions_on_search_results(**kwargs)
if entries_found_count != 0 and _has_action_args(args):
_print_changed_counts(journal)
else:
# display only occurs if no other action occurs
_display_search_results(**kwargs)
def _perform_actions_on_search_results(**kwargs):
args = kwargs["args"]
# Perform actions (if needed)
if args.change_time:
_change_time_search_results(**kwargs)
if args.delete:
_delete_search_results(**kwargs)
# open results in editor (if `--edit` was used)
if args.edit:
_edit_search_results(**kwargs)
def _is_append_mode(args: "Namespace", config: dict, **kwargs) -> bool:
"""Determines if we are in append mode (as opposed to search mode)"""
# Are any search filters present? If so, then search mode.
append_mode = (
not _has_search_args(args)
and not _has_action_args(args)
and not _has_display_args(args)
)
# Might be writing and want to move to editor part of the way through
if args.edit and args.text:
append_mode = True
# If the text is entirely tags, then we are also searching (not writing)
if append_mode and args.text and _has_only_tags(config["tagsymbols"], args.text):
append_mode = False
return append_mode
def append_mode(args: "Namespace", config: dict, journal: "Journal", **kwargs) -> None:
"""
Gets input from the user to write to the journal
0. Check for a template passed as an argument, or in the global config
1. Check for input from cli
2. Check input being piped in
3. Open editor if configured (prepopulated with template if available)
4. Use stdin.read as last resort
6. Write any found text to journal, or exit
"""
logging.debug("Append mode: starting")
template_text = _get_template(args, config)
if args.text:
logging.debug(f"Append mode: cli text detected: {args.text}")
raw = " ".join(args.text).strip()
if args.edit:
raw = _write_in_editor(config, raw)
elif not sys.stdin.isatty():
logging.debug("Append mode: receiving piped text")
raw = sys.stdin.read()
else:
raw = _write_in_editor(config, template_text)
if template_text is not None and raw == template_text:
logging.error("Append mode: raw text was the same as the template")
raise JrnlException(Message(MsgText.NoChangesToTemplate, MsgStyle.NORMAL))
if not raw or raw.isspace():
logging.error("Append mode: couldn't get raw text or entry was empty")
raise JrnlException(Message(MsgText.NoTextReceived, MsgStyle.NORMAL))
logging.debug(
f"Append mode: appending raw text to journal '{args.journal_name}': {raw}"
)
journal.new_entry(raw)
if args.journal_name != DEFAULT_JOURNAL_KEY:
print_msg(
Message(
MsgText.JournalEntryAdded,
MsgStyle.NORMAL,
{"journal_name": args.journal_name},
)
)
journal.write()
logging.debug("Append mode: completed journal.write()")
def _get_template(args, config) -> str:
# Read template file and pass as raw text into the composer
logging.debug(
"Get template:\n"
f"--template: {args.template}\n"
f"from config: {config.get('template')}"
)
template_path = args.template or config.get("template")
template_text = None
if template_path:
template_text = read_template_file(template_path)
return template_text
def search_mode(args: "Namespace", journal: "Journal", **kwargs) -> None:
"""
Search for entries in a journal, and return the
results. If no search args, then return all results
"""
logging.debug("Search mode: starting")
# If no search args, then return all results (don't filter anything)
if not _has_search_args(args) and not _has_display_args(args) and not args.text:
logging.debug("Search mode: has no search args")
return
logging.debug("Search mode: has search args")
_filter_journal_entries(args, journal)
def _write_in_editor(config: dict, prepopulated_text: str | None = None) -> str:
if config["editor"]:
logging.debug("Append mode: opening editor")
raw = get_text_from_editor(config, prepopulated_text)
else:
raw = get_text_from_stdin()
return raw
def _filter_journal_entries(args: "Namespace", journal: "Journal", **kwargs) -> None:
"""Filter journal entries in-place based upon search args"""
if args.on_date:
args.start_date = args.end_date = args.on_date
if args.today_in_history:
now = time.parse("now")
args.day = now.day
args.month = now.month
journal.filter(
tags=args.text,
month=args.month,
day=args.day,
year=args.year,
start_date=args.start_date,
end_date=args.end_date,
strict=args.strict,
starred=args.starred,
tagged=args.tagged,
exclude=args.excluded,
exclude_starred=args.exclude_starred,
exclude_tagged=args.exclude_tagged,
contains=args.contains,
)
journal.limit(args.limit)
def _print_entries_found_count(count: int, args: "Namespace") -> None:
logging.debug(f"count: {count}")
if count == 0:
if args.edit or args.change_time:
print_msg(Message(MsgText.NothingToModify, MsgStyle.WARNING))
elif args.delete:
print_msg(Message(MsgText.NothingToDelete, MsgStyle.WARNING))
else:
print_msg(Message(MsgText.NoEntriesFound, MsgStyle.NORMAL))
return
elif args.limit and args.limit == count:
# Don't show count if the user expects a limited number of results
logging.debug("args.limit is true-ish")
return
logging.debug("Printing general summary")
my_msg = (
MsgText.EntryFoundCountSingular if count == 1 else MsgText.EntryFoundCountPlural
)
print_msg(Message(my_msg, MsgStyle.NORMAL, {"num": count}))
def _other_entries(journal: "Journal", entries: list["Entry"]) -> list["Entry"]:
"""Find entries that are not in journal"""
return [e for e in entries if e not in journal.entries]
def _edit_search_results(
config: dict, journal: "Journal", old_entries: list["Entry"], **kwargs
) -> None:
"""
1. Send the given journal entries to the user-configured editor
2. Print out stats on any modifications to journal
3. Write modifications to journal
"""
if not config["editor"]:
raise JrnlException(
Message(
MsgText.EditorNotConfigured,
MsgStyle.ERROR,
{"config_file": get_config_path()},
)
)
# separate entries we are not editing
other_entries = _other_entries(journal, old_entries)
# Send user to the editor
try:
edited = get_text_from_editor(config, journal.editable_str())
except JrnlException as e:
if e.has_message_text(MsgText.NoTextReceived):
raise JrnlException(
Message(MsgText.NoEditsReceivedJournalNotDeleted, MsgStyle.WARNING)
)
else:
raise e
journal.parse_editable_str(edited)
# Put back entries we separated earlier, sort, and write the journal
journal.entries += other_entries
journal.sort()
journal.write()
def _print_changed_counts(journal: "Journal", **kwargs) -> None:
stats = journal.get_change_counts()
msgs = []
if stats["added"] > 0:
my_msg = (
MsgText.JournalCountAddedSingular
if stats["added"] == 1
else MsgText.JournalCountAddedPlural
)
msgs.append(Message(my_msg, MsgStyle.NORMAL, {"num": stats["added"]}))
if stats["deleted"] > 0:
my_msg = (
MsgText.JournalCountDeletedSingular
if stats["deleted"] == 1
else MsgText.JournalCountDeletedPlural
)
msgs.append(Message(my_msg, MsgStyle.NORMAL, {"num": stats["deleted"]}))
if stats["modified"] > 0:
my_msg = (
MsgText.JournalCountModifiedSingular
if stats["modified"] == 1
else MsgText.JournalCountModifiedPlural
)
msgs.append(Message(my_msg, MsgStyle.NORMAL, {"num": stats["modified"]}))
if not msgs:
msgs.append(Message(MsgText.NoEditsReceived, MsgStyle.NORMAL))
print_msgs(msgs)
def _get_predit_stats(journal: "Journal") -> dict[str, int]:
return {"count": len(journal)}
def _delete_search_results(
journal: "Journal", old_entries: list["Entry"], **kwargs
) -> None:
entries_to_delete = journal.prompt_action_entries(MsgText.DeleteEntryQuestion)
journal.entries = old_entries
if entries_to_delete:
journal.delete_entries(entries_to_delete)
journal.write()
def _change_time_search_results(
args: "Namespace",
journal: "Journal",
old_entries: list["Entry"],
no_prompt: bool = False,
**kwargs,
) -> None:
# separate entries we are not editing
# @todo if there's only 1, don't prompt
entries_to_change = journal.prompt_action_entries(MsgText.ChangeTimeEntryQuestion)
if entries_to_change:
date = time.parse(args.change_time)
journal.entries = old_entries
journal.change_date_entries(date, entries_to_change)
journal.write()
def _display_search_results(args: "Namespace", journal: "Journal", **kwargs) -> None:
if len(journal) == 0:
return
# Get export format from config file if not provided at the command line
args.export = args.export or kwargs["config"].get("display_format")
if args.tags:
print(plugins.get_exporter("tags").export(journal))
elif args.short or args.export == "short":
print(journal.pprint(short=True))
elif args.export == "pretty":
print(journal.pprint())
elif args.export:
exporter = plugins.get_exporter(args.export)
print(exporter.export(journal, args.filename))
else:
print(journal.pprint())
def _has_search_args(args: "Namespace") -> bool:
"""Looking for arguments that filter a journal"""
return any(
(
args.contains,
args.tagged,
args.excluded,
args.exclude_starred,
args.exclude_tagged,
args.end_date,
args.today_in_history,
args.month,
args.day,
args.year,
args.limit,
args.on_date,
args.starred,
args.start_date,
args.strict, # -and
)
)
def _has_action_args(args: "Namespace") -> bool:
return any(
(
args.change_time,
args.delete,
args.edit,
)
)
def _has_display_args(args: "Namespace") -> bool:
return any(
(
args.tags,
args.short,
args.export, # --format
)
)
def _has_only_tags(tag_symbols: str, args_text: str) -> bool:
return all(word[0] in tag_symbols for word in " ".join(args_text).split())

View file

@ -1,18 +1,25 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import logging import logging
import os import os
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
import textwrap
from pathlib import Path from pathlib import Path
from .color import ERROR_COLOR from jrnl.exception import JrnlException
from .color import RESET_COLOR from jrnl.messages import Message
from .os_compat import on_windows from jrnl.messages import MsgStyle
from .os_compat import split_args from jrnl.messages import MsgText
from jrnl.os_compat import on_windows
from jrnl.os_compat import split_args
from jrnl.output import print_msg
from jrnl.path import absolute_path
from jrnl.path import get_templates_path
def get_text_from_editor(config, template=""): def get_text_from_editor(config: dict, template: str = "") -> str:
suffix = ".jrnl" suffix = ".jrnl"
if config["template"]: if config["template"]:
template_filename = Path(config["template"]).name template_filename = Path(config["template"]).name
@ -26,37 +33,89 @@ def get_text_from_editor(config, template=""):
try: try:
subprocess.call(split_args(config["editor"]) + [tmpfile]) subprocess.call(split_args(config["editor"]) + [tmpfile])
except Exception as e: except FileNotFoundError:
error_msg = f""" raise JrnlException(
{ERROR_COLOR}{str(e)}{RESET_COLOR} Message(
MsgText.EditorMisconfigured,
Please check the 'editor' key in your config file for errors: MsgStyle.ERROR,
{repr(config['editor'])} {"editor_key": config["editor"]},
""" )
print(textwrap.dedent(error_msg).strip(), file=sys.stderr) )
exit(1)
with open(tmpfile, "r", encoding="utf-8") as f: with open(tmpfile, "r", encoding="utf-8") as f:
raw = f.read() raw = f.read()
os.remove(tmpfile) os.remove(tmpfile)
if not raw: if not raw:
print("[Nothing saved to file]", file=sys.stderr) raise JrnlException(Message(MsgText.NoTextReceived, MsgStyle.NORMAL))
return raw return raw
def get_text_from_stdin(): def get_text_from_stdin() -> str:
_how_to_quit = "Ctrl+z and then Enter" if on_windows() else "Ctrl+d" print_msg(
print( Message(
f"[Writing Entry; on a blank line, press {_how_to_quit} to finish writing]\n", MsgText.WritingEntryStart,
file=sys.stderr, MsgStyle.TITLE,
{
"how_to_quit": (
MsgText.HowToQuitWindows if on_windows() else MsgText.HowToQuitLinux
) )
},
)
)
try: try:
raw = sys.stdin.read() raw = sys.stdin.read()
except KeyboardInterrupt: except KeyboardInterrupt:
logging.error("Write mode: keyboard interrupt") logging.error("Append mode: keyboard interrupt")
print("[Entry NOT saved to journal]", file=sys.stderr) raise JrnlException(
sys.exit(0) Message(MsgText.KeyboardInterruptMsg, MsgStyle.ERROR_ON_NEW_LINE),
Message(MsgText.JournalNotSaved, MsgStyle.WARNING),
)
return raw return raw
def get_template_path(template_path: str, jrnl_template_dir: str) -> str:
actual_template_path = os.path.join(jrnl_template_dir, template_path)
if not os.path.exists(actual_template_path):
logging.debug(
f"Couldn't open {actual_template_path}. "
"Treating template path like a local / abs path."
)
actual_template_path = absolute_path(template_path)
return actual_template_path
def read_template_file(template_path: str) -> str:
"""
Reads the template file given a template path in this order:
* Check $XDG_DATA_HOME/jrnl/templates/template_path.
* Check template_arg as an absolute / relative path.
If a file is found, its contents are returned as a string.
If not, a JrnlException is raised.
"""
jrnl_template_dir = get_templates_path()
actual_template_path = get_template_path(template_path, jrnl_template_dir)
try:
with open(actual_template_path, encoding="utf-8") as f:
template_data = f.read()
return template_data
except FileNotFoundError:
raise JrnlException(
Message(
MsgText.CantReadTemplate,
MsgStyle.ERROR,
{
"template_path": template_path,
"actual_template_path": actual_template_path,
"jrnl_template_dir": str(jrnl_template_dir) + os.sep,
},
)
)

View file

@ -0,0 +1,53 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import logging
from abc import ABC
from abc import abstractmethod
from jrnl.exception import JrnlException
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
class BaseEncryption(ABC):
def __init__(self, journal_name: str, config: dict):
logging.debug("start")
self._encoding: str = "utf-8"
self._journal_name: str = journal_name
self._config: dict = config
def clear(self) -> None:
pass
def encrypt(self, text: str) -> bytes:
logging.debug("encrypting")
return self._encrypt(text)
def decrypt(self, text: bytes) -> str:
logging.debug("decrypting")
if (result := self._decrypt(text)) is None:
raise JrnlException(
Message(MsgText.DecryptionFailedGeneric, MsgStyle.ERROR)
)
return result
@abstractmethod
def _encrypt(self, text: str) -> bytes:
"""
This is needed because self.decrypt might need
to perform actions (e.g. prompt for password)
before actually encrypting.
"""
pass
@abstractmethod
def _decrypt(self, text: bytes) -> str | None:
"""
This is needed because self.decrypt might need
to perform actions (e.g. prompt for password)
before actually decrypting.
"""
pass

View file

@ -0,0 +1,8 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from .BaseEncryption import BaseEncryption
class BaseKeyEncryption(BaseEncryption):
pass

View file

@ -0,0 +1,82 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import logging
from jrnl.encryption.BaseEncryption import BaseEncryption
from jrnl.exception import JrnlException
from jrnl.keyring import get_keyring_password
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
from jrnl.prompt import create_password
from jrnl.prompt import prompt_password
class BasePasswordEncryption(BaseEncryption):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
logging.debug("start")
self._attempts: int = 0
self._max_attempts: int = 3
self._password: str = ""
self._check_keyring: bool = True
@property
def check_keyring(self) -> bool:
return self._check_keyring
@check_keyring.setter
def check_keyring(self, value: bool) -> None:
self._check_keyring = value
@property
def password(self) -> str | None:
return self._password
@password.setter
def password(self, value: str) -> None:
self._password = value
def clear(self):
self.password = None
self.check_keyring = False
def encrypt(self, text: str) -> bytes:
logging.debug("encrypting")
if not self.password:
if self.check_keyring and (
keyring_pw := get_keyring_password(self._journal_name)
):
self.password = keyring_pw
if not self.password:
self.password = create_password(self._journal_name)
return self._encrypt(text)
def decrypt(self, text: bytes) -> str:
logging.debug("decrypting")
if not self.password:
if self.check_keyring and (
keyring_pw := get_keyring_password(self._journal_name)
):
self.password = keyring_pw
if not self.password:
self._prompt_password()
while (result := self._decrypt(text)) is None:
self._prompt_password()
return result
def _prompt_password(self) -> None:
if self._attempts >= self._max_attempts:
raise JrnlException(
Message(MsgText.PasswordMaxTriesExceeded, MsgStyle.ERROR)
)
first_try = self._attempts == 0
self.password = prompt_password(first_try=first_try)
self._attempts += 1

View file

@ -0,0 +1,42 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import hashlib
import logging
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers import algorithms
from cryptography.hazmat.primitives.ciphers import modes
from jrnl.encryption.BasePasswordEncryption import BasePasswordEncryption
class Jrnlv1Encryption(BasePasswordEncryption):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
logging.debug("start")
def _encrypt(self, _: str) -> bytes:
raise NotImplementedError
def _decrypt(self, text: bytes) -> str | None:
logging.debug("decrypting")
iv, cipher = text[:16], text[16:]
password = self._password or ""
decryption_key = hashlib.sha256(password.encode(self._encoding)).digest()
decryptor = Cipher(
algorithms.AES(decryption_key), modes.CBC(iv), default_backend()
).decryptor()
try:
plain_padded = decryptor.update(cipher) + decryptor.finalize()
if plain_padded[-1] in (" ", 32):
# Ancient versions of jrnl. Do not judge me.
return plain_padded.decode(self._encoding).rstrip(" ")
else:
unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder()
plain = unpadder.update(plain_padded) + unpadder.finalize()
return plain.decode(self._encoding)
except ValueError:
return None

View file

@ -0,0 +1,59 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import base64
import logging
from cryptography.fernet import Fernet
from cryptography.fernet import InvalidToken
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from .BasePasswordEncryption import BasePasswordEncryption
class Jrnlv2Encryption(BasePasswordEncryption):
def __init__(self, *args, **kwargs) -> None:
# Salt is hard-coded
self._salt: bytes = b"\xf2\xd5q\x0e\xc1\x8d.\xde\xdc\x8e6t\x89\x04\xce\xf8"
self._key: bytes = b""
super().__init__(*args, **kwargs)
logging.debug("start")
@property
def password(self):
return self._password
@password.setter
def password(self, value: str | None):
self._password = value
self._make_key()
def _make_key(self) -> None:
if self._password is None:
# Password was removed after being set
self._key = None
return
password = self.password.encode(self._encoding)
kdf = PBKDF2HMAC(
algorithm=hashes.SHA256(),
length=32,
salt=self._salt,
iterations=100_000,
backend=default_backend(),
)
key = kdf.derive(password)
self._key = base64.urlsafe_b64encode(key)
def _encrypt(self, text: str) -> bytes:
logging.debug("encrypting")
return Fernet(self._key).encrypt(text.encode(self._encoding))
def _decrypt(self, text: bytes) -> str | None:
logging.debug("decrypting")
try:
return Fernet(self._key).decrypt(text).decode(self._encoding)
except (InvalidToken, IndexError):
return None

View file

@ -0,0 +1,20 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import logging
from jrnl.encryption.BaseEncryption import BaseEncryption
class NoEncryption(BaseEncryption):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
logging.debug("start")
def _encrypt(self, text: str) -> bytes:
logging.debug("encrypting")
return text.encode(self._encoding)
def _decrypt(self, text: bytes) -> str:
logging.debug("decrypting")
return text.decode(self._encoding)

View file

@ -0,0 +1,36 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from enum import Enum
from importlib import import_module
from typing import TYPE_CHECKING
from typing import Type
if TYPE_CHECKING:
from .BaseEncryption import BaseEncryption
class EncryptionMethods(str, Enum):
def __str__(self) -> str:
return self.value
NONE = "NoEncryption"
JRNLV1 = "Jrnlv1Encryption"
JRNLV2 = "Jrnlv2Encryption"
def determine_encryption_method(config: str | bool) -> Type["BaseEncryption"]:
ENCRYPTION_METHODS = {
True: EncryptionMethods.JRNLV2, # the default
False: EncryptionMethods.NONE,
"jrnlv1": EncryptionMethods.JRNLV1,
"jrnlv2": EncryptionMethods.JRNLV2,
}
key = config
if isinstance(config, str):
key = config.lower()
my_class = ENCRYPTION_METHODS[key]
return getattr(import_module(f"jrnl.encryption.{my_class}"), my_class)

View file

@ -1,38 +1,24 @@
# Copyright (C) 2012-2021 jrnl contributors # Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import textwrap
from typing import TYPE_CHECKING
from jrnl.output import print_msg
if TYPE_CHECKING:
from jrnl.messages import Message
from jrnl.messages import MsgText
class UserAbort(Exception): class JrnlException(Exception):
pass """Common exceptions raised by jrnl."""
def __init__(self, *messages: "Message"):
self.messages = messages
class UpgradeValidationException(Exception): def print(self) -> None:
"""Raised when the contents of an upgraded journal do not match the old journal""" for msg in self.messages:
print_msg(msg)
pass def has_message_text(self, message_text: "MsgText"):
return any([m.text == message_text for m in self.messages])
class JrnlError(Exception):
"""Common exceptions raised by jrnl. """
def __init__(self, error_type, **kwargs):
self.error_type = error_type
self.message = self._get_error_message(**kwargs)
def _get_error_message(self, **kwargs):
error_messages = {
"ConfigDirectoryIsFile": textwrap.dedent(
"""
The path to your jrnl configuration directory is a file, not a directory:
{config_directory_path}
Removing this file will allow jrnl to save its configuration.
"""
)
}
return error_messages[self.error_type].format(**kwargs)
pass

View file

@ -1,122 +1,173 @@
#!/usr/bin/env python # Copyright © 2012-2023 jrnl contributors
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import contextlib
import glob import glob
import logging import logging
import os import os
import sys import sys
from .config import DEFAULT_JOURNAL_KEY from rich.pretty import pretty_repr
from .config import get_config_path
from .config import get_default_config from jrnl import __version__
from .config import get_default_journal_path from jrnl.config import DEFAULT_JOURNAL_KEY
from .config import load_config from jrnl.config import get_config_path
from .config import save_config from jrnl.config import get_default_colors
from .config import verify_config_colors from jrnl.config import get_default_config
from .exception import UserAbort from jrnl.config import get_default_journal_path
from .prompt import yesno from jrnl.config import load_config
from .upgrade import is_old_version from jrnl.config import save_config
from jrnl.config import verify_config_colors
from jrnl.exception import JrnlException
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
from jrnl.output import print_msg
from jrnl.path import absolute_path
from jrnl.path import expand_path
from jrnl.path import home_dir
from jrnl.prompt import yesno
from jrnl.upgrade import is_old_version
def upgrade_config(config): def upgrade_config(config_data: dict, alt_config_path: str | None = None) -> None:
"""Checks if there are keys missing in a given config dict, and if so, updates the config file accordingly. """Checks if there are keys missing in a given config dict, and if so, updates the
This essentially automatically ports jrnl installations if new config parameters are introduced in later config file accordingly. This essentially automatically ports jrnl installations
versions.""" if new config parameters are introduced in later versions. Also checks for
existence of and difference in version number between config dict
and current jrnl version, and if so, update the config file accordingly.
Supply alt_config_path if using an alternate config through --config-file."""
default_config = get_default_config() default_config = get_default_config()
missing_keys = set(default_config).difference(config) missing_keys = set(default_config).difference(config_data)
if missing_keys: if missing_keys:
for key in missing_keys: for key in missing_keys:
config[key] = default_config[key] config_data[key] = default_config[key]
save_config(config)
print( different_version = config_data["version"] != __version__
f"[Configuration updated to newest version at {get_config_path()}]", if different_version:
file=sys.stderr, config_data["version"] = __version__
if missing_keys or different_version:
save_config(config_data, alt_config_path)
config_path = alt_config_path if alt_config_path else get_config_path()
print_msg(
Message(
MsgText.ConfigUpdated, MsgStyle.NORMAL, {"config_path": config_path}
)
) )
def load_or_install_jrnl(): def find_default_config() -> str:
"""
If jrnl is already installed, loads and returns a config object.
Else, perform various prompts to install jrnl.
"""
config_path = ( config_path = (
get_config_path() get_config_path()
if os.path.exists(get_config_path()) if os.path.exists(get_config_path())
else os.path.join(os.path.expanduser("~"), ".jrnl_config") else os.path.join(home_dir(), ".jrnl_config")
)
return config_path
def find_alt_config(alt_config: str) -> str:
if not os.path.exists(alt_config):
raise JrnlException(
Message(
MsgText.AltConfigNotFound, MsgStyle.ERROR, {"config_file": alt_config}
)
)
return alt_config
def load_or_install_jrnl(alt_config_path: str) -> dict:
"""
If jrnl is already installed, loads and returns a default config object.
If alternate config is specified via --config-file flag, it will be used.
Else, perform various prompts to install jrnl.
"""
config_path = (
find_alt_config(alt_config_path) if alt_config_path else find_default_config()
) )
if os.path.exists(config_path): if os.path.exists(config_path):
logging.debug("Reading configuration from file %s", config_path) logging.debug("Reading configuration from file %s", config_path)
config = load_config(config_path) config = load_config(config_path)
if config is None:
raise JrnlException(
Message(
MsgText.CantParseConfigFile,
MsgStyle.ERROR,
{
"config_path": config_path,
},
)
)
if is_old_version(config_path): if is_old_version(config_path):
from . import upgrade from jrnl import upgrade
try:
upgrade.upgrade_jrnl(config_path) upgrade.upgrade_jrnl(config_path)
except upgrade.UpgradeValidationException:
print("Aborting upgrade.", file=sys.stderr)
print(
"Please tell us about this problem at the following URL:",
file=sys.stderr,
)
print(
"https://github.com/jrnl-org/jrnl/issues/new?title=UpgradeValidationException",
file=sys.stderr,
)
print("Exiting.", file=sys.stderr)
sys.exit(1)
upgrade_config(config) upgrade_config(config, alt_config_path)
verify_config_colors(config) verify_config_colors(config)
else: else:
logging.debug("Configuration file not found, installing jrnl...") logging.debug("Configuration file not found, installing jrnl...")
try:
config = install() config = install()
except KeyboardInterrupt:
raise UserAbort("Installation aborted")
logging.debug('Using configuration "%s"', config) logging.debug('Using configuration:\n"%s"', pretty_repr(config))
return config return config
def install(): def install() -> dict:
_initialize_autocomplete() _initialize_autocomplete()
# Where to create the journal? # Where to create the journal?
default_journal_path = get_default_journal_path() default_journal_path = get_default_journal_path()
path_query = f"Path to your journal file (leave blank for {default_journal_path}): " user_given_path = print_msg(
journal_path = os.path.abspath(input(path_query).strip() or default_journal_path) Message(
default_config = get_default_config() MsgText.InstallJournalPathQuestion,
default_config["journals"][DEFAULT_JOURNAL_KEY] = os.path.expanduser( MsgStyle.PROMPT,
os.path.expandvars(journal_path) params={
"default_journal_path": default_journal_path,
},
),
get_input=True,
) )
journal_path = absolute_path(user_given_path or default_journal_path)
default_config = get_default_config()
default_config["journals"][DEFAULT_JOURNAL_KEY]["journal"] = journal_path
# If the folder doesn't exist, create it # If the folder doesn't exist, create it
path = os.path.split(default_config["journals"][DEFAULT_JOURNAL_KEY])[0] path = os.path.split(journal_path)[0]
try: with contextlib.suppress(OSError):
os.makedirs(path) os.makedirs(path)
except OSError:
pass
# Encrypt it? # Encrypt it?
encrypt = yesno( encrypt = yesno(Message(MsgText.EncryptJournalQuestion), default=False)
"Do you want to encrypt your journal? You can always change this later",
default=False,
)
if encrypt: if encrypt:
default_config["encrypt"] = True default_config["encrypt"] = True
print("Journal will be encrypted.", file=sys.stderr) print_msg(Message(MsgText.JournalEncrypted, MsgStyle.NORMAL))
# Use colors?
use_colors = yesno(Message(MsgText.UseColorsQuestion), default=True)
if use_colors:
default_config["colors"] = get_default_colors()
save_config(default_config) save_config(default_config)
print_msg(
Message(
MsgText.InstallComplete,
MsgStyle.NORMAL,
params={"config_path": get_config_path()},
)
)
return default_config return default_config
def _initialize_autocomplete(): def _initialize_autocomplete() -> None:
# readline is not included in Windows Active Python and perhaps some other distributions # readline is not included in Windows Active Python and perhaps some other distss
if sys.modules.get("readline"): if sys.modules.get("readline"):
import readline import readline
@ -125,8 +176,8 @@ def _initialize_autocomplete():
readline.set_completer(_autocomplete_path) readline.set_completer(_autocomplete_path)
def _autocomplete_path(text, state): def _autocomplete_path(text: str, state: int) -> list[str | None]:
expansions = glob.glob(os.path.expanduser(os.path.expandvars(text)) + "*") expansions = glob.glob(expand_path(text) + "*")
expansions = [e + "/" if os.path.isdir(e) else e for e in expansions] expansions = [e + "/" if os.path.isdir(e) else e for e in expansions]
expansions.append(None) expansions.append(None)
return expansions[state] return expansions[state]

View file

@ -1,27 +1,30 @@
#!/usr/bin/env python # Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from datetime import datetime import contextlib
import datetime
import fnmatch import fnmatch
import os import os
from pathlib import Path
import platform import platform
import plistlib import plistlib
import re import re
import socket import socket
import time import time
import uuid import uuid
import zoneinfo
from pathlib import Path
from xml.parsers.expat import ExpatError from xml.parsers.expat import ExpatError
import pytz
import tzlocal import tzlocal
from . import Entry from jrnl import __title__
from . import Journal from jrnl import __version__
from . import __title__
from . import __version__ from .Entry import Entry
from .Journal import Journal
class DayOne(Journal.Journal): class DayOne(Journal):
"""A special Journal handling DayOne files""" """A special Journal handling DayOne files"""
# InvalidFileException was added to plistlib in Python3.4 # InvalidFileException was added to plistlib in Python3.4
@ -34,13 +37,10 @@ class DayOne(Journal.Journal):
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.entries = [] self.entries = []
self._deleted_entries = [] self._deleted_entries = []
self.can_be_encrypted = False
super().__init__(**kwargs) super().__init__(**kwargs)
def open(self): def open(self) -> "DayOne":
filenames = [
os.path.join(self.config["journal"], "entries", f)
for f in os.listdir(os.path.join(self.config["journal"], "entries"))
]
filenames = [] filenames = []
for root, dirnames, f in os.walk(self.config["journal"]): for root, dirnames, f in os.walk(self.config["journal"]):
for filename in fnmatch.filter(f, "*.doentry"): for filename in fnmatch.filter(f, "*.doentry"):
@ -54,16 +54,17 @@ class DayOne(Journal.Journal):
pass pass
else: else:
try: try:
timezone = pytz.timezone(dict_entry["Time Zone"]) timezone = zoneinfo.ZoneInfo(dict_entry["Time Zone"])
except (KeyError, pytz.exceptions.UnknownTimeZoneError): except KeyError:
timezone = tzlocal.get_localzone() timezone_name = str(tzlocal.get_localzone())
timezone = zoneinfo.ZoneInfo(timezone_name)
date = dict_entry["Creation Date"] date = dict_entry["Creation Date"]
# convert the date to UTC rather than keep messing with # convert the date to UTC rather than keep messing with
# timezones # timezones
if timezone.zone != "UTC": if timezone.key != "UTC":
date = date + timezone.utcoffset(date, is_dst=False) date = date.replace(fold=1) + timezone.utcoffset(date)
entry = Entry.Entry( entry = Entry(
self, self,
date, date,
text=dict_entry["Entry Text"], text=dict_entry["Entry Text"],
@ -74,51 +75,36 @@ class DayOne(Journal.Journal):
self.config["tagsymbols"][0] + tag.lower() self.config["tagsymbols"][0] + tag.lower()
for tag in dict_entry.get("Tags", []) for tag in dict_entry.get("Tags", [])
] ]
if entry._tags:
entry._tags.sort()
"""Extended DayOne attributes""" """Extended DayOne attributes"""
try: # just ignore it if the keys don't exist
with contextlib.suppress(KeyError):
entry.creator_device_agent = dict_entry["Creator"][ entry.creator_device_agent = dict_entry["Creator"][
"Device Agent" "Device Agent"
] ]
except:
pass
try:
entry.creator_generation_date = dict_entry["Creator"][
"Generation Date"
]
except:
entry.creator_generation_date = date
try:
entry.creator_host_name = dict_entry["Creator"]["Host Name"] entry.creator_host_name = dict_entry["Creator"]["Host Name"]
except:
pass
try:
entry.creator_os_agent = dict_entry["Creator"]["OS Agent"] entry.creator_os_agent = dict_entry["Creator"]["OS Agent"]
except:
pass
try:
entry.creator_software_agent = dict_entry["Creator"][ entry.creator_software_agent = dict_entry["Creator"][
"Software Agent" "Software Agent"
] ]
except:
pass
try:
entry.location = dict_entry["Location"] entry.location = dict_entry["Location"]
except:
pass
try:
entry.weather = dict_entry["Weather"] entry.weather = dict_entry["Weather"]
except:
pass entry.creator_generation_date = dict_entry.get("Creator", {}).get(
"Generation Date", date
)
self.entries.append(entry) self.entries.append(entry)
self.sort() self.sort()
return self return self
def write(self): def write(self) -> None:
"""Writes only the entries that have been modified into plist files.""" """Writes only the entries that have been modified into plist files."""
for entry in self.entries: for entry in self.entries:
if entry.modified: if entry.modified:
utc_time = datetime.utcfromtimestamp( utc_time = datetime.datetime.utcfromtimestamp(
time.mktime(entry.date.timetuple()) time.mktime(entry.date.timetuple())
) )
@ -178,20 +164,20 @@ class DayOne(Journal.Journal):
) )
os.remove(filename) os.remove(filename)
def editable_str(self): def editable_str(self) -> str:
"""Turns the journal into a string of entries that can be edited """Turns the journal into a string of entries that can be edited
manually and later be parsed with eslf.parse_editable_str.""" manually and later be parsed with eslf.parse_editable_str."""
return "\n".join([f"{str(e)}\n# {e.uuid}\n" for e in self.entries]) return "\n".join([f"{str(e)}\n# {e.uuid}\n" for e in self.entries])
def _update_old_entry(self, entry, new_entry): def _update_old_entry(self, entry: Entry, new_entry: Entry) -> None:
for attr in ("title", "body", "date"): for attr in ("title", "body", "date", "tags"):
old_attr = getattr(entry, attr) old_attr = getattr(entry, attr)
new_attr = getattr(new_entry, attr) new_attr = getattr(new_entry, attr)
if old_attr != new_attr: if old_attr != new_attr:
entry.modified = True entry.modified = True
setattr(entry, attr, new_attr) setattr(entry, attr, new_attr)
def _get_and_remove_uuid_from_entry(self, entry): def _get_and_remove_uuid_from_entry(self, entry: Entry) -> Entry:
uuid_regex = "^ *?# ([a-zA-Z0-9]+) *?$" uuid_regex = "^ *?# ([a-zA-Z0-9]+) *?$"
m = re.search(uuid_regex, entry.body, re.MULTILINE) m = re.search(uuid_regex, entry.body, re.MULTILINE)
entry.uuid = m.group(1) if m else None entry.uuid = m.group(1) if m else None
@ -202,7 +188,7 @@ class DayOne(Journal.Journal):
return entry return entry
def parse_editable_str(self, edited): def parse_editable_str(self, edited: str) -> None:
"""Parses the output of self.editable_str and updates its entries.""" """Parses the output of self.editable_str and updates its entries."""
# Method: create a new list of entries from the edited text, then match # Method: create a new list of entries from the edited text, then match
# UUIDs of the new entries against self.entries, updating the entries # UUIDs of the new entries against self.entries, updating the entries
@ -212,6 +198,8 @@ class DayOne(Journal.Journal):
for entry in entries_from_editor: for entry in entries_from_editor:
entry = self._get_and_remove_uuid_from_entry(entry) entry = self._get_and_remove_uuid_from_entry(entry)
if entry._tags:
entry._tags.sort()
# Remove deleted entries # Remove deleted entries
edited_uuids = [e.uuid for e in entries_from_editor] edited_uuids = [e.uuid for e in entries_from_editor]
@ -221,5 +209,11 @@ class DayOne(Journal.Journal):
for entry in entries_from_editor: for entry in entries_from_editor:
for old_entry in self.entries: for old_entry in self.entries:
if entry.uuid == old_entry.uuid: if entry.uuid == old_entry.uuid:
if old_entry._tags:
tags_not_in_body = [
tag for tag in old_entry._tags if (tag not in entry._body)
]
if tags_not_in_body:
entry._tags.extend(tags_not_in_body.sort())
self._update_old_entry(old_entry, entry) self._update_old_entry(old_entry, entry)
break break

118
jrnl/Entry.py → jrnl/journals/Entry.py Executable file → Normal file
View file

@ -1,21 +1,30 @@
#!/usr/bin/env python # Copyright © 2012-2023 jrnl contributors
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import datetime
from datetime import datetime import logging
import os
import re import re
from typing import TYPE_CHECKING
import ansiwrap from jrnl.color import colorize
from jrnl.color import highlight_tags_with_background_color
from jrnl.output import wrap_with_ansi_colors
from .color import colorize if TYPE_CHECKING:
from .color import highlight_tags_with_background_color from .Journal import Journal
class Entry: class Entry:
def __init__(self, journal, date=None, text="", starred=False): def __init__(
self,
journal: "Journal",
date: datetime.datetime | None = None,
text: str = "",
starred: bool = False,
):
self.journal = journal # Reference to journal mainly to access its config self.journal = journal # Reference to journal mainly to access its config
self.date = date or datetime.now() self.date = date or datetime.datetime.now()
self.text = text self.text = text
self._title = None self._title = None
self._body = None self._body = None
@ -24,7 +33,7 @@ class Entry:
self.modified = False self.modified = False
@property @property
def fulltext(self): def fulltext(self) -> str:
return self.title + " " + self.body return self.title + " " + self.body
def _parse_text(self): def _parse_text(self):
@ -38,48 +47,48 @@ class Entry:
self._tags = list(self._parse_tags()) self._tags = list(self._parse_tags())
@property @property
def title(self): def title(self) -> str:
if self._title is None: if self._title is None:
self._parse_text() self._parse_text()
return self._title return self._title
@title.setter @title.setter
def title(self, x): def title(self, x: str):
self._title = x self._title = x
@property @property
def body(self): def body(self) -> str:
if self._body is None: if self._body is None:
self._parse_text() self._parse_text()
return self._body return self._body
@body.setter @body.setter
def body(self, x): def body(self, x: str):
self._body = x self._body = x
@property @property
def tags(self): def tags(self) -> list[str]:
if self._tags is None: if self._tags is None:
self._parse_text() self._parse_text()
return self._tags return self._tags
@tags.setter @tags.setter
def tags(self, x): def tags(self, x: list[str]):
self._tags = x self._tags = x
@staticmethod @staticmethod
def tag_regex(tagsymbols): def tag_regex(tagsymbols: str) -> re.Pattern:
pattern = fr"(?<!\S)([{tagsymbols}][-+*#/\w]+)" pattern = rf"(?<!\S)([{tagsymbols}][-+*#/\w]+)"
return re.compile(pattern) return re.compile(pattern)
def _parse_tags(self): def _parse_tags(self) -> set[str]:
tagsymbols = self.journal.config["tagsymbols"] tagsymbols = self.journal.config["tagsymbols"]
return { return {
tag.lower() for tag in re.findall(Entry.tag_regex(tagsymbols), self.text) tag.lower() for tag in re.findall(Entry.tag_regex(tagsymbols), self.text)
} }
def __str__(self): def __str__(self):
"""Returns a string representation of the entry to be written into a journal file.""" """Returns string representation of the entry to be written to journal file."""
date_str = self.date.strftime(self.journal.config["timeformat"]) date_str = self.date.strftime(self.journal.config["timeformat"])
title = "[{}] {}".format(date_str, self.title.rstrip("\n ")) title = "[{}] {}".format(date_str, self.title.rstrip("\n "))
if self.starred: if self.starred:
@ -90,7 +99,7 @@ class Entry:
body=self.body.rstrip("\n "), body=self.body.rstrip("\n "),
) )
def pprint(self, short=False): def pprint(self, short: bool = False) -> str:
"""Returns a pretty-printed version of the entry. """Returns a pretty-printed version of the entry.
If short is true, only print the title.""" If short is true, only print the title."""
# Handle indentation # Handle indentation
@ -106,8 +115,20 @@ class Entry:
) )
if not short and self.journal.config["linewrap"]: if not short and self.journal.config["linewrap"]:
columns = self.journal.config["linewrap"]
if columns == "auto":
try:
columns = os.get_terminal_size().columns
except OSError:
logging.debug(
"Can't determine terminal size automatically 'linewrap': '%s'",
self.journal.config["linewrap"],
)
columns = 79
# Color date / title and bold title # Color date / title and bold title
title = ansiwrap.fill( title = wrap_with_ansi_colors(
date_str date_str
+ " " + " "
+ highlight_tags_with_background_color( + highlight_tags_with_background_color(
@ -116,40 +137,22 @@ class Entry:
self.journal.config["colors"]["title"], self.journal.config["colors"]["title"],
is_title=True, is_title=True,
), ),
self.journal.config["linewrap"], columns,
) )
body = highlight_tags_with_background_color( body = highlight_tags_with_background_color(
self, self.body.rstrip(" \n"), self.journal.config["colors"]["body"] self, self.body.rstrip(" \n"), self.journal.config["colors"]["body"]
) )
body_text = [
colorize(
ansiwrap.fill(
line,
self.journal.config["linewrap"],
initial_indent=indent,
subsequent_indent=indent,
drop_whitespace=True,
),
self.journal.config["colors"]["body"],
)
or indent
for line in body.rstrip(" \n").splitlines()
]
# ansiwrap doesn't handle lines with only the "\n" character and some body = wrap_with_ansi_colors(body, columns - len(indent))
# ANSI escapes properly, so we have this hack here to make sure the if indent:
# beginning of each line has the indent character and it's colored # Without explicitly colorizing the indent character, it will lose its
# properly. textwrap doesn't have this issue, however, it doesn't wrap # color after a tag appears.
# the strings properly as it counts ANSI escapes as literal characters.
# TL;DR: I'm sorry.
body = "\n".join( body = "\n".join(
[
colorize(indent, self.journal.config["colors"]["body"]) + line colorize(indent, self.journal.config["colors"]["body"]) + line
if not ansiwrap.strip_color(line).startswith(indent) for line in body.splitlines()
else line
for line in body_text
]
) )
body = colorize(body, self.journal.config["colors"]["body"])
else: else:
title = ( title = (
date_str date_str
@ -185,7 +188,7 @@ class Entry:
def __hash__(self): def __hash__(self):
return hash(self.__repr__()) return hash(self.__repr__())
def __eq__(self, other): def __eq__(self, other: "Entry"):
if ( if (
not isinstance(other, Entry) not isinstance(other, Entry)
or self.title.strip() != other.title.strip() or self.title.strip() != other.title.strip()
@ -196,7 +199,7 @@ class Entry:
return False return False
return True return True
def __ne__(self, other): def __ne__(self, other: "Entry"):
return not self.__eq__(other) return not self.__eq__(other)
@ -204,18 +207,21 @@ class Entry:
# https://github.com/fnl/segtok # https://github.com/fnl/segtok
SENTENCE_SPLITTER = re.compile( SENTENCE_SPLITTER = re.compile(
r""" r"""
( # A sentence ends at one of two sequences: (
[.!?\u2026\u203C\u203D\u2047\u2048\u2049\u22EF\u3002\uFE52\uFE57\uFF01\uFF0E\uFF1F\uFF61] # Either, a sequence starting with a sentence terminal, [.!?\u2026\u203C\u203D\u2047\u2048\u2049\u22EF\uFE52\uFE57] # Sequence starting with a sentence terminal,
[\'\u2019\"\u201D]? # an optional right quote, [\'\u2019\"\u201D]? # an optional right quote,
[\]\)]* # optional closing brackets and [\]\)]* # optional closing bracket
\s+ # a sequence of required spaces. \s+ # AND a sequence of required spaces.
)""", )
|[\uFF01\uFF0E\uFF1F\uFF61\u3002] # CJK full/half width terminals usually do not have following spaces.
""", # noqa: E501
re.VERBOSE, re.VERBOSE,
) )
SENTENCE_SPLITTER_ONLY_NEWLINE = re.compile("\n") SENTENCE_SPLITTER_ONLY_NEWLINE = re.compile("\n")
def split_title(text): def split_title(text: str) -> tuple[str, str]:
"""Splits the first sentence off from a text.""" """Splits the first sentence off from a text."""
sep = SENTENCE_SPLITTER_ONLY_NEWLINE.search(text.lstrip()) sep = SENTENCE_SPLITTER_ONLY_NEWLINE.search(text.lstrip())
if not sep: if not sep:

View file

@ -0,0 +1,158 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import codecs
import os
import pathlib
from typing import TYPE_CHECKING
from jrnl import time
from .Journal import Journal
if TYPE_CHECKING:
from jrnl.journals import Entry
# glob search patterns for folder/file structure
DIGIT_PATTERN = "[0123456789]"
YEAR_PATTERN = DIGIT_PATTERN * 4
MONTH_PATTERN = "[01]" + DIGIT_PATTERN
DAY_PATTERN = "[0123]" + DIGIT_PATTERN + ".txt"
class Folder(Journal):
"""A Journal handling multiple files in a folder"""
def __init__(self, name: str = "default", **kwargs):
self.entries = []
self._diff_entry_dates = []
self.can_be_encrypted = False
super().__init__(name, **kwargs)
def open(self) -> "Folder":
filenames = []
self.entries = []
if os.path.exists(self.config["journal"]):
filenames = Folder._get_files(self.config["journal"])
for filename in filenames:
with codecs.open(filename, "r", "utf-8") as f:
journal = f.read()
self.entries.extend(self._parse(journal))
self.sort()
return self
def write(self) -> None:
"""Writes only the entries that have been modified into proper files."""
# Create a list of dates of modified entries. Start with diff_entry_dates
modified_dates = self._diff_entry_dates
seen_dates = set(self._diff_entry_dates)
for e in self.entries:
if e.modified:
if e.date not in modified_dates:
modified_dates.append(e.date)
if e.date not in seen_dates:
seen_dates.add(e.date)
# For every date that had a modified entry, write to a file
for d in modified_dates:
write_entries = []
filename = os.path.join(
self.config["journal"],
d.strftime("%Y"),
d.strftime("%m"),
d.strftime("%d") + ".txt",
)
dirname = os.path.dirname(filename)
# create directory if it doesn't exist
if not os.path.exists(dirname):
os.makedirs(dirname)
for e in self.entries:
if (
e.date.year == d.year
and e.date.month == d.month
and e.date.day == d.day
):
write_entries.append(e)
journal = "\n".join([e.__str__() for e in write_entries])
with codecs.open(filename, "w", "utf-8") as journal_file:
journal_file.write(journal)
# look for and delete empty files
filenames = []
filenames = Folder._get_files(self.config["journal"])
for filename in filenames:
if os.stat(filename).st_size <= 0:
os.remove(filename)
def delete_entries(self, entries_to_delete: list["Entry"]) -> None:
"""Deletes specific entries from a journal."""
for entry in entries_to_delete:
self.entries.remove(entry)
self._diff_entry_dates.append(entry.date)
self.deleted_entry_count += 1
def change_date_entries(self, date: str, entries_to_change: list["Entry"]) -> None:
"""Changes entry dates to given date."""
date = time.parse(date)
self._diff_entry_dates.append(date)
for entry in entries_to_change:
self._diff_entry_dates.append(entry.date)
entry.date = date
entry.modified = True
def parse_editable_str(self, edited: str) -> None:
"""Parses the output of self.editable_str and updates its entries."""
mod_entries = self._parse(edited)
diff_entries = set(self.entries) - set(mod_entries)
for e in diff_entries:
self._diff_entry_dates.append(e.date)
# Match those entries that can be found in self.entries and set
# these to modified, so we can get a count of how many entries got
# modified and how many got deleted later.
for entry in mod_entries:
entry.modified = not any(entry == old_entry for old_entry in self.entries)
self.increment_change_counts_by_edit(mod_entries)
self.entries = mod_entries
@staticmethod
def _get_files(journal_path: str) -> list[str]:
"""Searches through sub directories starting with journal_path and find all text
files that look like entries"""
for year_folder in Folder._get_year_folders(pathlib.Path(journal_path)):
for month_folder in Folder._get_month_folders(year_folder):
yield from Folder._get_day_files(month_folder)
@staticmethod
def _get_year_folders(path: pathlib.Path) -> list[pathlib.Path]:
for child in path.glob(YEAR_PATTERN):
if child.is_dir():
yield child
return
@staticmethod
def _get_month_folders(path: pathlib.Path) -> list[pathlib.Path]:
for child in path.glob(MONTH_PATTERN):
if int(child.name) > 0 and int(child.name) <= 12 and path.is_dir():
yield child
return
@staticmethod
def _get_day_files(path: pathlib.Path) -> list[str]:
for child in path.glob(DAY_PATTERN):
if (
int(child.stem) > 0
and int(child.stem) <= 31
and time.is_valid_date(
year=int(path.parent.name),
month=int(path.name),
day=int(child.stem),
)
and child.is_file()
):
yield str(child)

View file

@ -1,17 +1,22 @@
#!/usr/bin/env python # Copyright © 2012-2023 jrnl contributors
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import datetime
from datetime import datetime
import logging import logging
import os import os
import re import re
import sys
from . import Entry from jrnl import time
from . import time from jrnl.config import validate_journal_name
from .prompt import yesno from jrnl.encryption import determine_encryption_method
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
from jrnl.output import print_msg
from jrnl.path import expand_path
from jrnl.prompt import yesno
from .Entry import Entry
class Tag: class Tag:
@ -44,6 +49,11 @@ class Journal:
self.search_tags = None # Store tags we're highlighting self.search_tags = None # Store tags we're highlighting
self.name = name self.name = name
self.entries = [] self.entries = []
self.encryption_method = None
# Track changes to journal in session. Modified is tracked in Entry
self.added_entry_count = 0
self.deleted_entry_count = 0
def __len__(self): def __len__(self):
"""Returns the number of entries""" """Returns the number of entries"""
@ -54,7 +64,7 @@ class Journal:
return (entry for entry in self.entries) return (entry for entry in self.entries)
@classmethod @classmethod
def from_journal(cls, other): def from_journal(cls, other: "Journal") -> "Journal":
"""Creates a new journal by copying configuration and entries from """Creates a new journal by copying configuration and entries from
another journal object""" another journal object"""
new_journal = cls(other.name, **other.config) new_journal = cls(other.name, **other.config)
@ -67,60 +77,94 @@ class Journal:
) )
return new_journal return new_journal
def import_(self, other_journal_txt): def import_(self, other_journal_txt: str) -> None:
self.entries = list( imported_entries = self._parse(other_journal_txt)
frozenset(self.entries) | frozenset(self._parse(other_journal_txt)) for entry in imported_entries:
) entry.modified = True
self.entries = list(frozenset(self.entries) | frozenset(imported_entries))
self.sort() self.sort()
def open(self, filename=None): def _get_encryption_method(self) -> None:
"""Opens the journal file defined in the config and parses it into a list of Entries. encryption_method = determine_encryption_method(self.config["encrypt"])
self.encryption_method = encryption_method(self.name, self.config)
def _decrypt(self, text: bytes) -> str:
if self.encryption_method is None:
self._get_encryption_method()
return self.encryption_method.decrypt(text)
def _encrypt(self, text: str) -> bytes:
if self.encryption_method is None:
self._get_encryption_method()
return self.encryption_method.encrypt(text)
def open(self, filename: str | None = None) -> "Journal":
"""Opens the journal file and parses it into a list of Entries
Entries have the form (date, title, body).""" Entries have the form (date, title, body)."""
filename = filename or self.config["journal"] filename = filename or self.config["journal"]
dirname = os.path.dirname(filename) dirname = os.path.dirname(filename)
if not os.path.exists(filename): if not os.path.exists(filename):
if not os.path.isdir(dirname): if not os.path.isdir(dirname):
os.makedirs(dirname) os.makedirs(dirname)
print(f"[Directory {dirname} created]", file=sys.stderr) print_msg(
Message(
MsgText.DirectoryCreated,
MsgStyle.NORMAL,
{"directory_name": dirname},
)
)
self.create_file(filename) self.create_file(filename)
print(f"[Journal '{self.name}' created at {filename}]", file=sys.stderr) print_msg(
Message(
MsgText.JournalCreated,
MsgStyle.NORMAL,
{
"journal_name": self.name,
"filename": filename,
},
)
)
self.write()
text = self._load(filename) text = self._load(filename)
text = self._decrypt(text)
self.entries = self._parse(text) self.entries = self._parse(text)
self.sort() self.sort()
logging.debug("opened %s with %d entries", self.__class__.__name__, len(self)) logging.debug("opened %s with %d entries", self.__class__.__name__, len(self))
return self return self
def write(self, filename=None): def write(self, filename: str | None = None) -> None:
"""Dumps the journal into the config file, overwriting it""" """Dumps the journal into the config file, overwriting it"""
filename = filename or self.config["journal"] filename = filename or self.config["journal"]
text = self._to_text() text = self._to_text()
text = self._encrypt(text)
self._store(filename, text) self._store(filename, text)
def validate_parsing(self): def validate_parsing(self) -> bool:
"""Confirms that the jrnl is still parsed correctly after being dumped to text.""" """Confirms that the jrnl is still parsed correctly after conversion to text."""
new_entries = self._parse(self._to_text()) new_entries = self._parse(self._to_text())
for i, entry in enumerate(self.entries): return all(entry == new_entries[i] for i, entry in enumerate(self.entries))
if entry != new_entries[i]:
return False
return True
@staticmethod @staticmethod
def create_file(filename): def create_file(filename: str) -> None:
with open(filename, "w"): with open(filename, "w"):
pass pass
def _to_text(self): def _to_text(self) -> str:
return "\n".join([str(e) for e in self.entries]) return "\n".join([str(e) for e in self.entries])
def _load(self, filename): def _load(self, filename: str) -> bytes:
raise NotImplementedError with open(filename, "rb") as f:
return f.read()
@classmethod def _store(self, filename: str, text: bytes) -> None:
def _store(filename, text): with open(filename, "wb") as f:
raise NotImplementedError f.write(text)
def _parse(self, journal_txt): def _parse(self, journal_txt: str) -> list[Entry]:
"""Parses a journal that's stored in a string and returns a list of entries""" """Parses a journal that's stored in a string and returns a list of entries"""
# Return empty array if the journal is blank # Return empty array if the journal is blank
@ -135,7 +179,9 @@ class Journal:
for match in date_blob_re.finditer(journal_txt): for match in date_blob_re.finditer(journal_txt):
date_blob = match.groups()[0] date_blob = match.groups()[0]
try: try:
new_date = datetime.strptime(date_blob, self.config["timeformat"]) new_date = datetime.datetime.strptime(
date_blob, self.config["timeformat"]
)
except ValueError: except ValueError:
# Passing in a date that had brackets around it # Passing in a date that had brackets around it
new_date = time.parse(date_blob, bracketed=True) new_date = time.parse(date_blob, bracketed=True)
@ -144,11 +190,11 @@ class Journal:
if entries: if entries:
entries[-1].text = journal_txt[last_entry_pos : match.start()] entries[-1].text = journal_txt[last_entry_pos : match.start()]
last_entry_pos = match.end() last_entry_pos = match.end()
entries.append(Entry.Entry(self, date=new_date)) entries.append(Entry(self, date=new_date))
# If no entries were found, treat all the existing text as an entry made now # If no entries were found, treat all the existing text as an entry made now
if not entries: if not entries:
entries.append(Entry.Entry(self, date=time.parse("now"))) entries.append(Entry(self, date=time.parse("now")))
# Fill in the text of the last entry # Fill in the text of the last entry
entries[-1].text = journal_txt[last_entry_pos:] entries[-1].text = journal_txt[last_entry_pos:]
@ -157,7 +203,7 @@ class Journal:
entry._parse_text() entry._parse_text()
return entries return entries
def pprint(self, short=False): def pprint(self, short: bool = False) -> str:
"""Prettyprints the journal's entries""" """Prettyprints the journal's entries"""
return "\n".join([e.pprint(short=short) for e in self.entries]) return "\n".join([e.pprint(short=short) for e in self.entries])
@ -167,20 +213,21 @@ class Journal:
def __repr__(self): def __repr__(self):
return f"<Journal with {len(self.entries)} entries>" return f"<Journal with {len(self.entries)} entries>"
def sort(self): def sort(self) -> None:
"""Sorts the Journal's entries by date""" """Sorts the Journal's entries by date"""
self.entries = sorted(self.entries, key=lambda entry: entry.date) self.entries = sorted(self.entries, key=lambda entry: entry.date)
def limit(self, n=None): def limit(self, n: int | None = None) -> None:
"""Removes all but the last n entries""" """Removes all but the last n entries"""
if n: if n:
self.entries = self.entries[-n:] self.entries = self.entries[-n:]
@property @property
def tags(self): def tags(self) -> list[Tag]:
"""Returns a set of tuples (count, tag) for all tags present in the journal.""" """Returns a set of tuples (count, tag) for all tags present in the journal."""
# Astute reader: should the following line leave you as puzzled as me the first time # Astute reader: should the following line leave you as puzzled as me the first
# I came across this construction, worry not and embrace the ensuing moment of enlightment. # time I came across this construction, worry not and embrace the ensuing moment
# of enlightment.
tags = [tag for entry in self.entries for tag in set(entry.tags)] tags = [tag for entry in self.entries for tag in set(entry.tags)]
# To be read: [for entry in journal.entries: for tag in set(entry.tags): tag] # To be read: [for entry in journal.entries: for tag in set(entry.tags): tag]
tag_counts = {(tags.count(tag), tag) for tag in tags} tag_counts = {(tags.count(tag), tag) for tag in tags}
@ -195,8 +242,11 @@ class Journal:
start_date=None, start_date=None,
end_date=None, end_date=None,
starred=False, starred=False,
tagged=False,
exclude_starred=False,
exclude_tagged=False,
strict=False, strict=False,
contains=None, contains=[],
exclude=[], exclude=[],
): ):
"""Removes all entries from the journal that don't match the filter. """Removes all entries from the journal that don't match the filter.
@ -218,10 +268,15 @@ class Journal:
start_date = time.parse(start_date) start_date = time.parse(start_date)
# If strict mode is on, all tags have to be present in entry # If strict mode is on, all tags have to be present in entry
tagged = self.search_tags.issubset if strict else self.search_tags.intersection has_tags = (
excluded = lambda tags: len([tag for tag in tags if tag in excluded_tags]) > 0 self.search_tags.issubset if strict else self.search_tags.intersection
)
def excluded(tags):
return 0 < len([tag for tag in tags if tag in excluded_tags])
if contains: if contains:
contains_lower = contains.casefold() contains_lower = [substring.casefold() for substring in contains]
# Create datetime object for comparison below # Create datetime object for comparison below
# this approach allows various formats # this approach allows various formats
@ -231,8 +286,9 @@ class Journal:
result = [ result = [
entry entry
for entry in self.entries for entry in self.entries
if (not tags or tagged(entry.tags)) if (not tags or has_tags(entry.tags))
and (not starred or entry.starred) and (not (starred or exclude_starred) or entry.starred == starred)
and (not (tagged or exclude_tagged) or bool(entry.tags) == tagged)
and (not month or entry.date.month == compare_d.month) and (not month or entry.date.month == compare_d.month)
and (not day or entry.date.day == compare_d.day) and (not day or entry.date.day == compare_d.day)
and (not year or entry.date.year == compare_d.year) and (not year or entry.date.year == compare_d.year)
@ -242,40 +298,67 @@ class Journal:
and ( and (
not contains not contains
or ( or (
contains_lower in entry.title.casefold() strict
or contains_lower in entry.body.casefold() and all(
substring in entry.title.casefold()
or substring in entry.body.casefold()
for substring in contains_lower
)
)
or (
not strict
and any(
substring in entry.title.casefold()
or substring in entry.body.casefold()
for substring in contains_lower
)
) )
) )
] ]
self.entries = result self.entries = result
def delete_entries(self, entries_to_delete): def delete_entries(self, entries_to_delete: list[Entry]) -> None:
"""Deletes specific entries from a journal.""" """Deletes specific entries from a journal."""
for entry in entries_to_delete: for entry in entries_to_delete:
self.entries.remove(entry) self.entries.remove(entry)
self.deleted_entry_count += 1
def prompt_delete_entries(self): def change_date_entries(
"""Prompts for deletion of each of the entries in a journal. self, date: datetime.datetime, entries_to_change: list[Entry]
Returns the entries the user wishes to delete.""" ) -> None:
"""Changes entry dates to given date."""
date = time.parse(date)
to_delete = [] for entry in entries_to_change:
entry.date = date
entry.modified = True
def ask_delete(entry): def prompt_action_entries(self, msg: MsgText) -> list[Entry]:
"""Prompts for action for each entry in a journal, using given message.
Returns the entries the user wishes to apply the action on."""
to_act = []
def ask_action(entry):
return yesno( return yesno(
f"Delete entry '{entry.pprint(short=True)}'?", Message(
msg,
params={"entry_title": entry.pprint(short=True)},
),
default=False, default=False,
) )
for entry in self.entries: for entry in self.entries:
if ask_delete(entry): if ask_action(entry):
to_delete.append(entry) to_act.append(entry)
return to_delete return to_act
def new_entry(self, raw, date=None, sort=True): def new_entry(self, raw: str, date=None, sort: bool = True) -> Entry:
"""Constructs a new entry from some raw text input. """Constructs a new entry from some raw text input.
If a date is given, it will parse and use this, otherwise scan for a date in the input first.""" If a date is given, it will parse and use this, otherwise scan for a date in
the input first.
"""
raw = raw.replace("\\n ", "\n").replace("\\n", "\n") raw = raw.replace("\\n ", "\n").replace("\\n", "\n")
# Split raw text into title and body # Split raw text into title and body
@ -302,19 +385,19 @@ class Journal:
) )
if not date: # Still nothing? Meh, just live in the moment. if not date: # Still nothing? Meh, just live in the moment.
date = time.parse("now") date = time.parse("now")
entry = Entry.Entry(self, date, raw, starred=starred) entry = Entry(self, date, raw, starred=starred)
entry.modified = True entry.modified = True
self.entries.append(entry) self.entries.append(entry)
if sort: if sort:
self.sort() self.sort()
return entry return entry
def editable_str(self): def editable_str(self) -> str:
"""Turns the journal into a string of entries that can be edited """Turns the journal into a string of entries that can be edited
manually and later be parsed with eslf.parse_editable_str.""" manually and later be parsed with self.parse_editable_str."""
return "\n".join([str(e) for e in self.entries]) return "\n".join([str(e) for e in self.entries])
def parse_editable_str(self, edited): def parse_editable_str(self, edited: str) -> None:
"""Parses the output of self.editable_str and updates it's entries.""" """Parses the output of self.editable_str and updates it's entries."""
mod_entries = self._parse(edited) mod_entries = self._parse(edited)
# Match those entries that can be found in self.entries and set # Match those entries that can be found in self.entries and set
@ -322,17 +405,23 @@ class Journal:
# modified and how many got deleted later. # modified and how many got deleted later.
for entry in mod_entries: for entry in mod_entries:
entry.modified = not any(entry == old_entry for old_entry in self.entries) entry.modified = not any(entry == old_entry for old_entry in self.entries)
self.increment_change_counts_by_edit(mod_entries)
self.entries = mod_entries self.entries = mod_entries
def increment_change_counts_by_edit(self, mod_entries: Entry) -> None:
if len(mod_entries) > len(self.entries):
self.added_entry_count += len(mod_entries) - len(self.entries)
else:
self.deleted_entry_count += len(self.entries) - len(mod_entries)
class PlainJournal(Journal): def get_change_counts(self) -> dict:
def _load(self, filename): return {
with open(filename, "r", encoding="utf-8") as f: "added": self.added_entry_count,
return f.read() "deleted": self.deleted_entry_count,
"modified": len([e for e in self.entries if e.modified]),
def _store(self, filename, text): }
with open(filename, "w", encoding="utf-8") as f:
f.write(text)
class LegacyJournal(Journal): class LegacyJournal(Journal):
@ -340,15 +429,11 @@ class LegacyJournal(Journal):
standard. Main difference here is that in 1.x, timestamps were not cuddled standard. Main difference here is that in 1.x, timestamps were not cuddled
by square brackets. You'll not be able to save these journals anymore.""" by square brackets. You'll not be able to save these journals anymore."""
def _load(self, filename): def _parse(self, journal_txt: str) -> list[Entry]:
with open(filename, "r", encoding="utf-8") as f:
return f.read()
def _parse(self, journal_txt):
"""Parses a journal that's stored in a string and returns a list of entries""" """Parses a journal that's stored in a string and returns a list of entries"""
# Entries start with a line that looks like 'date title' - let's figure out how # Entries start with a line that looks like 'date title' - let's figure out how
# long the date will be by constructing one # long the date will be by constructing one
date_length = len(datetime.today().strftime(self.config["timeformat"])) date_length = len(datetime.datetime.today().strftime(self.config["timeformat"]))
# Initialise our current entry # Initialise our current entry
entries = [] entries = []
@ -358,7 +443,7 @@ class LegacyJournal(Journal):
line = line.rstrip() line = line.rstrip()
try: try:
# try to parse line as date => new entry begins # try to parse line as date => new entry begins
new_date = datetime.strptime( new_date = datetime.datetime.strptime(
line[:date_length], self.config["timeformat"] line[:date_length], self.config["timeformat"]
) )
@ -372,7 +457,7 @@ class LegacyJournal(Journal):
else: else:
starred = False starred = False
current_entry = Entry.Entry( current_entry = Entry(
self, date=new_date, text=line[date_length + 1 :], starred=starred self, date=new_date, text=line[date_length + 1 :], starred=starred
) )
except ValueError: except ValueError:
@ -391,41 +476,50 @@ class LegacyJournal(Journal):
return entries return entries
def open_journal(journal_name, config, legacy=False): def open_journal(journal_name: str, config: dict, legacy: bool = False) -> Journal:
""" """
Creates a normal, encrypted or DayOne journal based on the passed config. Creates a normal, encrypted or DayOne journal based on the passed config.
If legacy is True, it will open Journals with legacy classes build for If legacy is True, it will open Journals with legacy classes build for
backwards compatibility with jrnl 1.x backwards compatibility with jrnl 1.x
""" """
logging.debug(f"open_journal '{journal_name}'")
validate_journal_name(journal_name, config)
config = config.copy() config = config.copy()
config["journal"] = os.path.expanduser(os.path.expandvars(config["journal"])) config["journal"] = expand_path(config["journal"])
if os.path.isdir(config["journal"]): if os.path.isdir(config["journal"]):
if config["encrypt"]:
print_msg(
Message(
MsgText.ConfigEncryptedForUnencryptableJournalType,
MsgStyle.WARNING,
{
"journal_name": journal_name,
},
)
)
if config["journal"].strip("/").endswith(".dayone") or "entries" in os.listdir( if config["journal"].strip("/").endswith(".dayone") or "entries" in os.listdir(
config["journal"] config["journal"]
): ):
from . import DayOneJournal from jrnl.journals import DayOne
return DayOneJournal.DayOne(**config).open() return DayOne(**config).open()
else: else:
from . import FolderJournal from jrnl.journals import Folder
return FolderJournal.Folder(**config).open() return Folder(journal_name, **config).open()
if not config["encrypt"]: if not config["encrypt"]:
if legacy: if legacy:
return LegacyJournal(journal_name, **config).open() return LegacyJournal(journal_name, **config).open()
return PlainJournal(journal_name, **config).open() if config["journal"].endswith(os.sep):
from jrnl.journals import Folder
from . import EncryptedJournal return Folder(journal_name, **config).open()
return Journal(journal_name, **config).open()
try:
if legacy: if legacy:
return EncryptedJournal.LegacyEncryptedJournal( config["encrypt"] = "jrnlv1"
journal_name, **config return LegacyJournal(journal_name, **config).open()
).open() return Journal(journal_name, **config).open()
return EncryptedJournal.EncryptedJournal(journal_name, **config).open()
except KeyboardInterrupt:
# Since encrypted journals prompt for a password, it's easy for a user to ctrl+c out
print("[Interrupted while opening journal]", file=sys.stderr)
sys.exit(1)

View file

@ -0,0 +1,5 @@
from .DayOneJournal import DayOne
from .Entry import Entry
from .FolderJournal import Folder
from .Journal import Journal
from .Journal import open_journal

View file

@ -1,332 +0,0 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import logging
import sys
from . import install
from . import plugins
from .Journal import open_journal
from .color import ERROR_COLOR
from .color import RESET_COLOR
from .config import get_journal_name
from .config import scope_config
from .config import get_config_path
from .editor import get_text_from_editor
from .editor import get_text_from_stdin
from .exception import UserAbort
from . import time
def run(args):
"""
Flow:
1. Run standalone command if it doesn't require config (help, version, etc), then exit
2. Load config
3. Run standalone command if it does require config (encrypt, decrypt, etc), then exit
4. Load specified journal
5. Start write mode, or search mode
6. Profit
"""
# Run command if possible before config is available
if callable(args.preconfig_cmd):
return args.preconfig_cmd(args)
# Load the config, and extract journal name
try:
config = install.load_or_install_jrnl()
original_config = config.copy()
args = get_journal_name(args, config)
config = scope_config(config, args.journal_name)
except UserAbort as err:
print(f"\n{err}", file=sys.stderr)
sys.exit(1)
# Run post-config command now that config is ready
if callable(args.postconfig_cmd):
return args.postconfig_cmd(
args=args, config=config, original_config=original_config
)
# --- All the standalone commands are now done --- #
# Get the journal we're going to be working with
journal = open_journal(args.journal_name, config)
kwargs = {
"args": args,
"config": config,
"journal": journal,
}
if _is_write_mode(**kwargs):
write_mode(**kwargs)
else:
search_mode(**kwargs)
def _is_write_mode(args, config, **kwargs):
"""Determines if we are in write mode (as opposed to search mode)"""
write_mode = True
# Are any search filters present? If so, then search mode.
write_mode = not any(
(
args.contains,
args.delete,
args.edit,
args.export,
args.end_date,
args.today_in_history,
args.month,
args.day,
args.year,
args.limit,
args.on_date,
args.short,
args.starred,
args.start_date,
args.strict,
args.tags,
)
)
# Might be writing and want to move to editor part of the way through
if args.edit and args.text:
write_mode = True
# If the text is entirely tags, then we are also searching (not writing)
if (
write_mode
and args.text
and all(word[0] in config["tagsymbols"] for word in " ".join(args.text).split())
):
write_mode = False
return write_mode
def write_mode(args, config, journal, **kwargs):
"""
Gets input from the user to write to the journal
1. Check for input from cli
2. Check input being piped in
3. Open editor if configured (prepopulated with template if available)
4. Use stdin.read as last resort
6. Write any found text to journal, or exit
"""
logging.debug("Write mode: starting")
if args.text:
logging.debug("Write mode: cli text detected: %s", args.text)
raw = " ".join(args.text).strip()
if args.edit:
raw = _write_in_editor(config, raw)
elif not sys.stdin.isatty():
logging.debug("Write mode: receiving piped text")
raw = sys.stdin.read()
else:
raw = _write_in_editor(config)
if not raw:
logging.error("Write mode: couldn't get raw text")
sys.exit()
logging.debug(
'Write mode: appending raw text to journal "%s": %s', args.journal_name, raw
)
journal.new_entry(raw)
print(f"[Entry added to {args.journal_name} journal]", file=sys.stderr)
journal.write()
logging.debug("Write mode: completed journal.write()", args.journal_name, raw)
def search_mode(args, journal, **kwargs):
"""
Search for entries in a journal, then either:
1. Send them to configured editor for user manipulation
2. Delete them (with confirmation for each entry)
3. Display them (with formatting options)
"""
kwargs = {
**kwargs,
"args": args,
"journal": journal,
"old_entries": journal.entries,
}
# Filters the journal entries in place
_search_journal(**kwargs)
# Where do the search results go?
if args.edit:
_edit_search_results(**kwargs)
elif args.delete:
_delete_search_results(**kwargs)
else:
_display_search_results(**kwargs)
def _write_in_editor(config, template=None):
if config["editor"]:
logging.debug("Write mode: opening editor")
if not template:
template = _get_editor_template(config)
raw = get_text_from_editor(config, template)
else:
raw = get_text_from_stdin()
return raw
def _get_editor_template(config, **kwargs):
logging.debug("Write mode: loading template for entry")
if not config["template"]:
logging.debug("Write mode: no template configured")
return ""
try:
template = open(config["template"]).read()
logging.debug("Write mode: template loaded: %s", template)
except OSError:
logging.error("Write mode: template not loaded")
print(
f"[Could not read template at '{config['template']}']",
file=sys.stderr,
)
sys.exit(1)
return template
def _search_journal(args, journal, **kwargs):
""" Search the journal with the given args"""
if args.on_date:
args.start_date = args.end_date = args.on_date
if args.today_in_history:
now = time.parse("now")
args.day = now.day
args.month = now.month
journal.filter(
tags=args.text,
month=args.month,
day=args.day,
year=args.year,
start_date=args.start_date,
end_date=args.end_date,
strict=args.strict,
starred=args.starred,
exclude=args.excluded,
contains=args.contains,
)
journal.limit(args.limit)
def _edit_search_results(config, journal, old_entries, **kwargs):
"""
1. Send the given journal entries to the user-configured editor
2. Print out stats on any modifications to journal
3. Write modifications to journal
"""
if not config["editor"]:
print(
f"""
[{ERROR_COLOR}ERROR{RESET_COLOR}: There is no editor configured.]
Please specify an editor in config file ({get_config_path()})
to use the --edit option.
""",
file=sys.stderr,
)
sys.exit(1)
# separate entries we are not editing
other_entries = [e for e in old_entries if e not in journal.entries]
# Get stats now for summary later
old_stats = _get_predit_stats(journal)
# Send user to the editor
edited = get_text_from_editor(config, journal.editable_str())
journal.parse_editable_str(edited)
# Print summary if available
_print_edited_summary(journal, old_stats)
# Put back entries we separated earlier, sort, and write the journal
journal.entries += other_entries
journal.sort()
journal.write()
def _print_edited_summary(journal, old_stats, **kwargs):
stats = {
"deleted": old_stats["count"] - len(journal),
"modified": len([e for e in journal.entries if e.modified]),
}
prompts = []
if stats["deleted"]:
prompts.append(
f"{stats['deleted']} {_pluralize_entry(stats['deleted'])} deleted"
)
if stats["modified"]:
prompts.append(
f"{stats['modified']} {_pluralize_entry(stats['modified'])} modified"
)
if prompts:
print(f"[{', '.join(prompts).capitalize()}]", file=sys.stderr)
def _get_predit_stats(journal):
return {"count": len(journal)}
def _pluralize_entry(num):
return "entry" if num == 1 else "entries"
def _delete_search_results(journal, old_entries, **kwargs):
if not journal.entries:
print(
"[No entries deleted, because the search returned no results.]",
file=sys.stderr,
)
sys.exit(1)
entries_to_delete = journal.prompt_delete_entries()
if entries_to_delete:
journal.entries = old_entries
journal.delete_entries(entries_to_delete)
journal.write()
def _display_search_results(args, journal, **kwargs):
if args.short:
print(journal.pprint(short=True))
elif args.tags:
print(plugins.get_exporter("tags").export(journal))
elif args.export:
exporter = plugins.get_exporter(args.export)
print(exporter.export(journal, args.filename))
elif kwargs["config"].get("display_format"):
exporter = plugins.get_exporter(kwargs["config"]["display_format"])
print(exporter.export(journal, args.filename))
else:
print(journal.pprint())

29
jrnl/keyring.py Normal file
View file

@ -0,0 +1,29 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import keyring
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
from jrnl.output import print_msg
def get_keyring_password(journal_name: str = "default") -> str | None:
try:
return keyring.get_password("jrnl", journal_name)
except keyring.errors.KeyringError as e:
if not isinstance(e, keyring.errors.NoKeyringError):
print_msg(Message(MsgText.KeyringRetrievalFailure, MsgStyle.ERROR))
return None
def set_keyring_password(password: str, journal_name: str = "default") -> None:
try:
return keyring.set_password("jrnl", journal_name, password)
except keyring.errors.KeyringError as e:
if isinstance(e, keyring.errors.NoKeyringError):
msg = Message(MsgText.KeyringBackendNotFound, MsgStyle.WARNING)
else:
msg = Message(MsgText.KeyringRetrievalFailure, MsgStyle.ERROR)
print_msg(msg)

88
jrnl/main.py Normal file
View file

@ -0,0 +1,88 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import logging
import sys
import traceback
from rich.logging import RichHandler
from jrnl import controller
from jrnl.args import parse_args
from jrnl.exception import JrnlException
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
from jrnl.output import print_msg
def configure_logger(debug: bool = False) -> None:
if not debug:
logging.disable()
return
logging.basicConfig(
level=logging.DEBUG,
datefmt="[%X]",
format="%(message)s",
handlers=[RichHandler()],
)
logging.getLogger("parsedatetime").setLevel(logging.INFO)
logging.getLogger("keyring.backend").setLevel(logging.ERROR)
logging.debug("Logging start")
def run(manual_args: list[str] | None = None) -> int:
try:
if manual_args is None:
manual_args = sys.argv[1:]
args = parse_args(manual_args)
configure_logger(args.debug)
logging.debug("Parsed args:\n%s", args)
status_code = controller.run(args)
except JrnlException as e:
status_code = 1
e.print()
except KeyboardInterrupt:
status_code = 1
print_msg(
Message(
MsgText.KeyboardInterruptMsg,
MsgStyle.ERROR_ON_NEW_LINE,
)
)
except Exception as e:
# uncaught exception
status_code = 1
debug = False
try:
if args.debug: # type: ignore
debug = True
except NameError:
# This should only happen when the exception
# happened before the args were parsed
if "--debug" in sys.argv:
debug = True
if debug:
from rich.console import Console
traceback.print_tb(sys.exc_info()[2])
Console(stderr=True).print_exception(extra_lines=1)
print_msg(
Message(
MsgText.UncaughtException,
MsgStyle.ERROR,
{"name": type(e).__name__, "exception": e},
)
)
# This should be the only exit point
return status_code

17
jrnl/messages/Message.py Normal file
View file

@ -0,0 +1,17 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from typing import TYPE_CHECKING
from typing import Mapping
from typing import NamedTuple
from jrnl.messages.MsgStyle import MsgStyle
if TYPE_CHECKING:
from jrnl.messages.MsgText import MsgText
class Message(NamedTuple):
text: "MsgText"
style: MsgStyle = MsgStyle.NORMAL
params: Mapping = {}

93
jrnl/messages/MsgStyle.py Normal file
View file

@ -0,0 +1,93 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from enum import Enum
from typing import Callable
from typing import NamedTuple
from rich import box
from rich.panel import Panel
from jrnl.messages.MsgText import MsgText
class MsgStyle(Enum):
class _Color(NamedTuple):
"""
String representing a standard color to display
see: https://rich.readthedocs.io/en/stable/appendix/colors.html
"""
color: str
class _Decoration(Enum):
NONE = {
"callback": lambda x, **_: x,
"args": {},
}
BOX = {
"callback": Panel,
"args": {
"expand": False,
"padding": (0, 2),
"title_align": "left",
"box": box.HEAVY,
},
}
@property
def callback(self) -> Callable:
return self.value["callback"]
@property
def args(self) -> dict:
return self.value["args"]
PROMPT = {
"decoration": _Decoration.NONE,
"color": _Color("white"),
"append_space": True,
}
TITLE = {
"decoration": _Decoration.BOX,
"color": _Color("cyan"),
}
NORMAL = {
"decoration": _Decoration.BOX,
"color": _Color("white"),
}
WARNING = {
"decoration": _Decoration.BOX,
"color": _Color("yellow"),
}
ERROR = {
"decoration": _Decoration.BOX,
"color": _Color("red"),
"box_title": str(MsgText.Error),
}
ERROR_ON_NEW_LINE = {
"decoration": _Decoration.BOX,
"color": _Color("red"),
"prepend_newline": True,
"box_title": str(MsgText.Error),
}
@property
def decoration(self) -> _Decoration:
return self.value["decoration"]
@property
def color(self) -> _Color:
return self.value["color"].color
@property
def prepend_newline(self) -> bool:
return self.value.get("prepend_newline", False)
@property
def append_space(self) -> bool:
return self.value.get("append_space", False)
@property
def box_title(self) -> MsgText:
return self.value.get("box_title")

291
jrnl/messages/MsgText.py Normal file
View file

@ -0,0 +1,291 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from enum import Enum
class MsgText(Enum):
def __str__(self) -> str:
return self.value
# -- Welcome --- #
WelcomeToJrnl = """
Welcome to jrnl {version}!
It looks like you've been using an older version of jrnl until now. That's
okay - jrnl will now upgrade your configuration and journal files. Afterwards
you can enjoy all of the great new features that come with jrnl 2:
- Support for storing your journal in multiple files
- Faster reading and writing for large journals
- New encryption back-end that makes installing jrnl much easier
- Tons of bug fixes
Please note that jrnl 1.x is NOT forward compatible with this version of jrnl.
If you choose to proceed, you will not be able to use your journals with
older versions of jrnl anymore.
"""
AllDoneUpgrade = "We're all done here and you can start enjoying jrnl 2"
InstallComplete = """
jrnl configuration created at {config_path}
For advanced features, read the docs at https://jrnl.sh
"""
# --- Prompts --- #
InstallJournalPathQuestion = """
Path to your journal file (leave blank for {default_journal_path}):
"""
DeleteEntryQuestion = "Delete entry '{entry_title}'?"
ChangeTimeEntryQuestion = "Change time for '{entry_title}'?"
EncryptJournalQuestion = """
Do you want to encrypt your journal? (You can always change this later)
"""
UseColorsQuestion = """
Do you want jrnl to use colors to display entries? (You can always change this later)
""" # noqa: E501 - the line is still under 88 when dedented
YesOrNoPromptDefaultYes = "[Y/n]"
YesOrNoPromptDefaultNo = "[y/N]"
ContinueUpgrade = "Continue upgrading jrnl?"
# these should be lowercase, if possible in language
# "lowercase" means whatever `.lower()` returns
OneCharacterYes = "y"
OneCharacterNo = "n"
# --- Exceptions ---#
Error = "Error"
UncaughtException = """
{name}
{exception}
This is probably a bug. Please file an issue at:
https://github.com/jrnl-org/jrnl/issues/new/choose
"""
ConfigDirectoryIsFile = """
Problem with config file!
The path to your jrnl configuration directory is a file, not a directory:
{config_directory_path}
Removing this file will allow jrnl to save its configuration.
"""
CantParseConfigFile = """
Unable to parse config file at:
{config_path}
"""
LineWrapTooSmallForDateFormat = """
The provided linewrap value of {config_linewrap} is too small by
{columns} columns to display the timestamps in the configured time
format for journal {journal}.
You can avoid this error by specifying a linewrap value that is larger
by at least {columns} in the configuration file or by using
--config-override at the command line
"""
CannotEncryptJournalType = """
The journal {journal_name} can't be encrypted because it is a
{journal_type} journal.
To encrypt it, create a new journal referencing a file, export
this journal to the new journal, then encrypt the new journal.
"""
ConfigEncryptedForUnencryptableJournalType = """
The config for journal "{journal_name}" has 'encrypt' set to true, but this type
of journal can't be encrypted. Please fix your config file.
"""
DecryptionFailedGeneric = "The decryption of journal data failed."
KeyboardInterruptMsg = "Aborted by user"
CantReadTemplate = """
Unable to find a template file {template_path}.
The following paths were checked:
* {jrnl_template_dir}{template_path}
* {actual_template_path}
"""
NoNamedJournal = "No '{journal_name}' journal configured\n{journals}"
DoesNotExist = "{name} does not exist"
# --- Journal status ---#
JournalNotSaved = "Entry NOT saved to journal"
JournalEntryAdded = "Entry added to {journal_name} journal"
JournalCountAddedSingular = "{num} entry added"
JournalCountModifiedSingular = "{num} entry modified"
JournalCountDeletedSingular = "{num} entry deleted"
JournalCountAddedPlural = "{num} entries added"
JournalCountModifiedPlural = "{num} entries modified"
JournalCountDeletedPlural = "{num} entries deleted"
JournalCreated = "Journal '{journal_name}' created at {filename}"
DirectoryCreated = "Directory {directory_name} created"
JournalEncrypted = "Journal will be encrypted"
JournalEncryptedTo = "Journal encrypted to {path}"
JournalDecryptedTo = "Journal decrypted to {path}"
BackupCreated = "Created a backup at {filename}"
# --- Editor ---#
WritingEntryStart = """
Writing Entry
To finish writing, press {how_to_quit} on a blank line.
"""
HowToQuitWindows = "Ctrl+z and then Enter"
HowToQuitLinux = "Ctrl+d"
EditorMisconfigured = """
No such file or directory: '{editor_key}'
Please check the 'editor' key in your config file for errors:
editor: '{editor_key}'
"""
EditorNotConfigured = """
There is no editor configured
To use the --edit option, please specify an editor your config file:
{config_file}
For examples of how to configure an external editor, see:
https://jrnl.sh/en/stable/external-editors/
"""
NoEditsReceivedJournalNotDeleted = """
No text received from editor. Were you trying to delete all the entries?
This seems a bit drastic, so the operation was cancelled.
To delete all entries, use the --delete option.
"""
NoEditsReceived = "No edits to save, because nothing was changed"
NoTextReceived = """
No entry to save, because no text was received
"""
NoChangesToTemplate = """
No entry to save, because the template was not changed
"""
# --- Upgrade --- #
JournalFailedUpgrade = """
The following journal{s} failed to upgrade:
{failed_journals}
Please tell us about this problem at the following URL:
https://github.com/jrnl-org/jrnl/issues/new?title=JournalFailedUpgrade
"""
UpgradeAborted = "jrnl was NOT upgraded"
AbortingUpgrade = "Aborting upgrade..."
ImportAborted = "Entries were NOT imported"
JournalsToUpgrade = """
The following journals will be upgraded to jrnl {version}:
"""
JournalsToIgnore = """
The following journals will not be touched:
"""
UpgradingJournal = """
Upgrading '{journal_name}' journal stored in {path}...
"""
UpgradingConfig = "Upgrading config..."
PaddedJournalName = "{journal_name:{pad}} -> {path}"
# -- Config --- #
AltConfigNotFound = """
Alternate configuration file not found at the given path:
{config_file}
"""
ConfigUpdated = """
Configuration updated to newest version at {config_path}
"""
ConfigDoubleKeys = """
There is at least one duplicate key in your configuration file.
Details:
{error_message}
"""
# --- Password --- #
Password = "Password:"
PasswordFirstEntry = "Enter password for journal '{journal_name}': "
PasswordConfirmEntry = "Enter password again: "
PasswordMaxTriesExceeded = "Too many attempts with wrong password"
PasswordCanNotBeEmpty = "Password can't be empty!"
PasswordDidNotMatch = "Passwords did not match, please try again"
WrongPasswordTryAgain = "Wrong password, try again"
PasswordStoreInKeychain = "Do you want to store the password in your keychain?"
# --- Search --- #
NothingToDelete = """
No entries to delete, because the search returned no results
"""
NothingToModify = """
No entries to modify, because the search returned no results
"""
NoEntriesFound = "no entries found"
EntryFoundCountSingular = "{num} entry found"
EntryFoundCountPlural = "{num} entries found"
# --- Formats --- #
HeadingsPastH6 = """
Headings increased past H6 on export - {date} {title}
"""
YamlMustBeDirectory = """
YAML export must be to a directory, not a single file
"""
JournalExportedTo = "Journal exported to {path}"
# --- Import --- #
ImportSummary = """
{count} imported to {journal_name} journal
"""
ImporterNotFound = """
No importer found for file type '{format}'.
'{format}' is likely to be an export-only format.
"""
# --- Color --- #
InvalidColor = "{key} set to invalid color: {color}"
# --- Keyring --- #
KeyringBackendNotFound = """
Keyring backend not found.
Please install one of the supported backends by visiting:
https://pypi.org/project/keyring/
"""
KeyringRetrievalFailure = "Failed to retrieve keyring"
# --- Deprecation --- #
DeprecatedCommand = """
The command {old_cmd} is deprecated and will be removed from jrnl soon.
Please use {new_cmd} instead.
"""

10
jrnl/messages/__init__.py Normal file
View file

@ -0,0 +1,10 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
Message = Message.Message
MsgStyle = MsgStyle.MsgStyle
MsgText = MsgText.MsgText

View file

@ -1,18 +1,18 @@
# Copyright (C) 2012-2021 jrnl contributors # Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import shlex import shlex
from sys import platform from sys import platform
def on_windows(): def on_windows() -> bool:
return "win32" in platform return "win32" in platform
def on_posix(): def on_posix() -> bool:
return not on_windows() return not on_windows()
def split_args(args): def split_args(args: str) -> list[str]:
"""Split arguments and add escape characters as appropriate for the OS""" """Split arguments and add escape characters as appropriate for the OS"""
return shlex.split(args, posix=on_posix()) return shlex.split(args, posix=on_posix())

Some files were not shown because too many files have changed in this diff Show more