Compare commits

..

No commits in common. "develop" and "v4.1-beta2" have entirely different histories.

50 changed files with 1064 additions and 1791 deletions

View file

@ -11,7 +11,7 @@ runs:
shell: bash shell: bash
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
allow-prereleases: true allow-prereleases: true
@ -21,7 +21,7 @@ runs:
shell: bash shell: bash
- name: poetry cache # Change CACHE_STRING secret to bust the cache - name: poetry cache # Change CACHE_STRING secret to bust the cache
uses: actions/cache@v4 uses: actions/cache@v3
with: with:
path: .venv path: .venv
key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ env.PYTHON_FULL_VERSION }}-${{ inputs.cache-string }} key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ env.PYTHON_FULL_VERSION }}-${{ inputs.cache-string }}
@ -34,7 +34,7 @@ runs:
echo '::endgroup::' echo '::endgroup::'
echo '::group::Other dependencies' echo '::group::Other dependencies'
poetry sync poetry install --remove-untracked
echo '::endgroup::' echo '::endgroup::'
echo 'DEPS_INSTALLED=true' >> $GITHUB_ENV echo 'DEPS_INSTALLED=true' >> $GITHUB_ENV

View file

@ -39,7 +39,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
@ -50,13 +50,13 @@ jobs:
run: echo "PYTHON_FULL_VERSION=$(python --version)" >> "$GITHUB_ENV" run: echo "PYTHON_FULL_VERSION=$(python --version)" >> "$GITHUB_ENV"
- name: poetry cache - name: poetry cache
uses: actions/cache@v4 uses: actions/cache@v3
with: with:
path: .venv path: .venv
key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ env.PYTHON_FULL_VERSION }}-${{ secrets.CACHE_STRING }} key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ env.PYTHON_FULL_VERSION }}-${{ secrets.CACHE_STRING }}
- name: npm cache - name: npm cache
uses: actions/cache@v4 uses: actions/cache@v3
with: with:
path: node_modules path: node_modules
key: ${{ runner.os }}-pa11y-v3 key: ${{ runner.os }}-pa11y-v3
@ -65,7 +65,7 @@ jobs:
run: | run: |
pip install poetry pip install poetry
poetry config --local virtualenvs.in-project true poetry config --local virtualenvs.in-project true
poetry sync --no-root poetry install --no-root --remove-untracked
npm install npm install
echo "node_modules/.bin" >> "$GITHUB_PATH" echo "node_modules/.bin" >> "$GITHUB_PATH"

View file

@ -19,6 +19,11 @@ on:
type: boolean type: boolean
required: true required: true
default: true default: true
include_brew:
description: 'Publish to Homebrew?'
type: boolean
required: true
default: true
jobs: jobs:
validate: validate:
@ -61,9 +66,9 @@ jobs:
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@v5 uses: actions/setup-python@v4
with: with:
python-version: '3.13' python-version: '3.11'
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -107,3 +112,111 @@ jobs:
run: | run: |
pypi_version="$(find 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 "pypi_version=$pypi_version" >> "$GITHUB_OUTPUT" 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: Set env variables
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: Tap formula
run: |
brew tap "${FORMULA_REPO}"
echo '::debug::Set tap directory'
echo "BREW_TAP_DIRECTORY=$(brew --repo "${FORMULA_REPO}")" >> "$GITHUB_ENV"
- 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_NAME}"
--url $(jq ".releases[\"${PYPI_VERSION}\"][1].url" -r api_response.json)
--sha256 $(jq ".releases[\"${PYPI_VERSION}\"][1].digests.sha256" -r api_response.json)
--no-audit
--write-only
--force
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
path: ${{ env.BREW_TAP_DIRECTORY }}
token: ${{ secrets.JRNL_BOT_TOKEN }}
push-to-fork: ${{ env.BOT_REPO }}
committer: ${{ secrets.JRNL_BOT_NAME }} <${{ secrets.JRNL_BOT_EMAIL }}>
author: ${{ secrets.JRNL_BOT_NAME }} <${{ secrets.JRNL_BOT_EMAIL }}>
title: jrnl ${{ env.JRNL_VERSION }}
body: Created with `brew bump-formula-pr`
branch: jrnl-${{ env.JRNL_VERSION }}--
branch-suffix: random
commit-message: |
jrnl ${{ env.JRNL_VERSION }}
Update jrnl to ${{ env.JRNL_VERSION }}
${{ secrets.RELEASE_COAUTHORS }}

View file

@ -37,7 +37,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13' ] python-version: [ '3.10', '3.11', '3.12' ]
os: [ ubuntu-latest, macos-latest, windows-latest ] os: [ ubuntu-latest, macos-latest, windows-latest ]
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false

View file

@ -17,7 +17,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13' ] python-version: [ '3.10', '3.11', '3.12' ]
os: [ ubuntu-latest, macos-latest, windows-latest ] os: [ ubuntu-latest, macos-latest, windows-latest ]
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false

View file

@ -2,111 +2,23 @@
## [Unreleased](https://github.com/jrnl-org/jrnl/) ## [Unreleased](https://github.com/jrnl-org/jrnl/)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.2.1...HEAD) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.1-beta...HEAD)
**Fixed bugs:** **Fixed bugs:**
- poetry warning - "poetry.dev-dependencies" section is deprecated [\#1975](https://github.com/jrnl-org/jrnl/issues/1975) - Update from `4.0.1\_4` to `4.0.1\_5` broke something with colors [\#1819](https://github.com/jrnl-org/jrnl/issues/1819)
- Homebrew autobump error on jrnl release [\#1961](https://github.com/jrnl-org/jrnl/issues/1961)
**Build:** ## [v4.1-beta](https://pypi.org/project/jrnl/v4.1-beta/) (2023-10-29)
- Remove release step to publish to Homebrew [\#1994](https://github.com/jrnl-org/jrnl/pull/1994) ([micahellison](https://github.com/micahellison)) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.0.1...v4.1-beta)
**Packaging:**
- 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))
## [v4.2.1](https://pypi.org/project/jrnl/v4.2.1/) (2025-02-25)
[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:** **Implemented enhancements:**
- Add Python 3.13 support [\#1893](https://github.com/jrnl-org/jrnl/issues/1893) - Add Python 3.12 support [\#1750](https://github.com/jrnl-org/jrnl/issues/1750)
- 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:** **Build:**
- Add Python 3.12 support [\#1761](https://github.com/jrnl-org/jrnl/pull/1761) ([micahellison](https://github.com/micahellison)) - Linting rules aren't enforced the same as format rules [\#1742](https://github.com/jrnl-org/jrnl/issues/1742)
- Set new required build fields in the ReadTheDocs config file [\#1803](https://github.com/jrnl-org/jrnl/pull/1803) ([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)) - 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))
@ -116,25 +28,47 @@
**Packaging:** **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 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 cryptography to v41.0.5 [\#1815](https://github.com/jrnl-org/jrnl/pull/1815) ([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)) - Update dependency tzlocal to v5.2 [\#1814](https://github.com/jrnl-org/jrnl/pull/1814) ([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))
**Special thanks:** - Update dependency black to v23.10.1 [\#1811](https://github.com/jrnl-org/jrnl/pull/1811) ([renovate[bot]](https://github.com/apps/renovate))
- 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) - 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 pytest-bdd to v7 [\#1807](https://github.com/jrnl-org/jrnl/pull/1807) ([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 tzlocal to v5.1 [\#1804](https://github.com/jrnl-org/jrnl/pull/1804) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruamel.yaml to v0.17.35 [\#1802](https://github.com/jrnl-org/jrnl/pull/1802) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency poethepoet to v0.24.0 [\#1798](https://github.com/jrnl-org/jrnl/pull/1798) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruff to v0.0.292 [\#1797](https://github.com/jrnl-org/jrnl/pull/1797) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency cryptography to v41.0.4 [\#1796](https://github.com/jrnl-org/jrnl/pull/1796) ([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 rich to v13.6.0 [\#1794](https://github.com/jrnl-org/jrnl/pull/1794) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruff to v0.0.290 [\#1792](https://github.com/jrnl-org/jrnl/pull/1792) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency black to v23.9.1 [\#1791](https://github.com/jrnl-org/jrnl/pull/1791) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency black to v23.9.0 [\#1790](https://github.com/jrnl-org/jrnl/pull/1790) ([renovate[bot]](https://github.com/apps/renovate))
- Update actions/checkout action to v4 [\#1788](https://github.com/jrnl-org/jrnl/pull/1788) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest to v7.4.2 [\#1787](https://github.com/jrnl-org/jrnl/pull/1787) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency poethepoet to v0.22.1 [\#1785](https://github.com/jrnl-org/jrnl/pull/1785) ([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 mkdocs to v1.5.2 [\#1780](https://github.com/jrnl-org/jrnl/pull/1780) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency cryptography to v41.0.3 [\#1779](https://github.com/jrnl-org/jrnl/pull/1779) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruff to v0.0.287 [\#1778](https://github.com/jrnl-org/jrnl/pull/1778) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency rich to v13.5.2 [\#1776](https://github.com/jrnl-org/jrnl/pull/1776) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency rich to v13.5.0 [\#1775](https://github.com/jrnl-org/jrnl/pull/1775) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency mkdocs to v1.5.1 [\#1774](https://github.com/jrnl-org/jrnl/pull/1774) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruff to v0.0.280 [\#1773](https://github.com/jrnl-org/jrnl/pull/1773) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency cryptography to v41.0.2 [\#1770](https://github.com/jrnl-org/jrnl/pull/1770) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency black to v23.7.0 [\#1769](https://github.com/jrnl-org/jrnl/pull/1769) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency poethepoet to v0.21.1 [\#1767](https://github.com/jrnl-org/jrnl/pull/1767) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tox to v4.6.4 [\#1765](https://github.com/jrnl-org/jrnl/pull/1765) ([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 keyring to v24.2.0 [\#1760](https://github.com/jrnl-org/jrnl/pull/1760) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency keyring to v24 [\#1758](https://github.com/jrnl-org/jrnl/pull/1758) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency pytest to v7.4.0 [\#1757](https://github.com/jrnl-org/jrnl/pull/1757) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency rich to v13.4.2 [\#1754](https://github.com/jrnl-org/jrnl/pull/1754) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency cryptography to v41 [\#1753](https://github.com/jrnl-org/jrnl/pull/1753) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency ruamel.yaml to v0.17.32 [\#1752](https://github.com/jrnl-org/jrnl/pull/1752) ([renovate[bot]](https://github.com/apps/renovate))
- Update dependency tox to v4.6.3 [\#1751](https://github.com/jrnl-org/jrnl/pull/1751) ([renovate[bot]](https://github.com/apps/renovate))
## [v4.0.1](https://pypi.org/project/jrnl/v4.0.1/) (2023-06-20) ## [v4.0.1](https://pypi.org/project/jrnl/v4.0.1/) (2023-06-20)

View file

@ -7,14 +7,24 @@ License: https://www.gnu.org/licenses/gpl-3.0.html
## Installation ## Installation
The easiest way to install `jrnl` is using On Mac and Linux, the easiest way to install `jrnl` is using
[pipx](https://pipx.pypa.io/stable/installation/) [Homebrew](http://brew.sh/):
with [Python](https://www.python.org/) 3.10+:
``` sh
brew install jrnl
```
On other platforms, install `jrnl` using [Python](https://www.python.org/) 3.10+ 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.

View file

@ -14,35 +14,6 @@ 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
@ -227,6 +198,25 @@ vim.api.nvim_create_autocmd( {"BufNewFile","BufReadPre" }, {
Please see `:h <option>` in Neovim for more information about the options mentioned. Please see `:h <option>` in Neovim for more information about the options mentioned.
## 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.
## 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.
## Notice any other risks? ## Notice any other risks?
Please let the maintainers know by [filing an issue on GitHub](https://github.com/jrnl-org/jrnl/issues). Please let the maintainers know by [filing an issue on GitHub](https://github.com/jrnl-org/jrnl/issues).

View file

@ -139,9 +139,3 @@ 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;
}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -65,7 +65,7 @@ License: https://www.gnu.org/licenses/gpl-3.0.html
<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">Tell your friends on X</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>
</nav> </nav>
<div class="flex"> <div class="flex">
<section> <section>
@ -103,7 +103,7 @@ License: https://www.gnu.org/licenses/gpl-3.0.html
<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="https://unpkg.com/typed.js@2.1.0/dist/typed.umd.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/typed.js/2.0.12/typed.min.js"></script>
<script> <script>
new Typed("#typed", { new Typed("#typed", {
strings: [ strings: [

View file

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

View file

@ -1 +1 @@
__version__ = "v4.2.1" __version__ = "v4.1-beta2"

View file

@ -265,7 +265,6 @@ def parse_args(args: list[str] = []) -> argparse.Namespace:
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 " help="Show entries containing specific text (put quotes around text with "
"spaces)", "spaces)",

View file

@ -76,17 +76,7 @@ def postconfig_import(args: argparse.Namespace, config: dict, **_) -> int:
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 return 0

View file

@ -58,9 +58,9 @@ def get_text_from_stdin() -> str:
MsgText.WritingEntryStart, MsgText.WritingEntryStart,
MsgStyle.TITLE, MsgStyle.TITLE,
{ {
"how_to_quit": ( "how_to_quit": MsgText.HowToQuitWindows
MsgText.HowToQuitWindows if on_windows() else MsgText.HowToQuitLinux if on_windows()
) else MsgText.HowToQuitLinux
}, },
) )
) )

View file

@ -246,7 +246,7 @@ class Journal:
exclude_starred=False, exclude_starred=False,
exclude_tagged=False, exclude_tagged=False,
strict=False, strict=False,
contains=[], contains=None,
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.
@ -276,7 +276,7 @@ class Journal:
return 0 < len([tag for tag in tags if tag in excluded_tags]) return 0 < len([tag for tag in tags if tag in excluded_tags])
if contains: if contains:
contains_lower = [substring.casefold() for substring in contains] contains_lower = contains.casefold()
# Create datetime object for comparison below # Create datetime object for comparison below
# this approach allows various formats # this approach allows various formats
@ -298,20 +298,8 @@ class Journal:
and ( and (
not contains not contains
or ( or (
strict contains_lower in entry.title.casefold()
and all( or contains_lower in entry.body.casefold()
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
)
) )
) )
] ]

View file

@ -266,11 +266,6 @@ class MsgText(Enum):
{count} imported to {journal_name} journal {count} imported to {journal_name} journal
""" """
ImporterNotFound = """
No importer found for file type '{format}'.
'{format}' is likely to be an export-only format.
"""
# --- Color --- # # --- Color --- #
InvalidColor = "{key} set to invalid color: {color}" InvalidColor = "{key} set to invalid color: {color}"

View file

@ -3,7 +3,6 @@
from typing import Type from typing import Type
from jrnl.plugins.calendar_heatmap_exporter import CalendarHeatmapExporter
from jrnl.plugins.dates_exporter import DatesExporter from jrnl.plugins.dates_exporter import DatesExporter
from jrnl.plugins.fancy_exporter import FancyExporter from jrnl.plugins.fancy_exporter import FancyExporter
from jrnl.plugins.jrnl_importer import JRNLImporter from jrnl.plugins.jrnl_importer import JRNLImporter
@ -15,15 +14,14 @@ from jrnl.plugins.xml_exporter import XMLExporter
from jrnl.plugins.yaml_exporter import YAMLExporter from jrnl.plugins.yaml_exporter import YAMLExporter
__exporters = [ __exporters = [
CalendarHeatmapExporter,
DatesExporter,
FancyExporter,
JSONExporter, JSONExporter,
MarkdownExporter, MarkdownExporter,
TagExporter, TagExporter,
DatesExporter,
TextExporter, TextExporter,
XMLExporter, XMLExporter,
YAMLExporter, YAMLExporter,
FancyExporter,
] ]
__importers = [JRNLImporter] __importers = [JRNLImporter]

View file

@ -1,117 +0,0 @@
# Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import calendar
from datetime import datetime
from typing import TYPE_CHECKING
from rich import box
from rich.align import Align
from rich.columns import Columns
from rich.console import Console
from rich.table import Table
from rich.text import Text
from jrnl.plugins.text_exporter import TextExporter
from jrnl.plugins.util import get_journal_frequency_nested
if TYPE_CHECKING:
from jrnl.journals import Entry
from jrnl.journals import Journal
from jrnl.plugins.util import NestedDict
class CalendarHeatmapExporter(TextExporter):
"""This Exporter displays a calendar heatmap of the journaling frequency."""
names = ["calendar", "heatmap"]
extension = "cal"
@classmethod
def export_entry(cls, entry: "Entry"):
raise NotImplementedError
@classmethod
def print_calendar_heatmap(cls, journal_frequency: "NestedDict") -> str:
"""Returns a string representation of the calendar heatmap."""
console = Console()
cal = calendar.Calendar()
curr_year = datetime.now().year
curr_month = datetime.now().month
curr_day = datetime.now().day
hit_first_entry = False
with console.capture() as capture:
for year, month_journaling_freq in journal_frequency.items():
year_calendar = []
for month in range(1, 13):
if month > curr_month and year == curr_year:
break
entries_this_month = sum(month_journaling_freq[month].values())
if not hit_first_entry and entries_this_month > 0:
hit_first_entry = True
if entries_this_month == 0 and not hit_first_entry:
continue
elif entries_this_month == 0:
entry_msg = "No entries"
elif entries_this_month == 1:
entry_msg = "1 entry"
else:
entry_msg = f"{entries_this_month} entries"
table = Table(
title=f"{calendar.month_name[month]} {year} ({entry_msg})",
title_style="bold green",
box=box.SIMPLE_HEAVY,
padding=0,
)
for week_day in cal.iterweekdays():
table.add_column(
"{:.3}".format(calendar.day_name[week_day]), justify="right"
)
month_days = cal.monthdayscalendar(year, month)
for weekdays in month_days:
days = []
for _, day in enumerate(weekdays):
if day == 0: # Not a part of this month, just filler.
day_label = Text(str(day or ""), style="white")
elif (
day > curr_day
and month == curr_month
and year == curr_year
):
break
else:
journal_frequency_for_day = (
month_journaling_freq[month][day] or 0
)
day = str(day)
# TODO: Make colors configurable?
if journal_frequency_for_day == 0:
day_label = Text(day, style="red on black")
elif journal_frequency_for_day == 1:
day_label = Text(day, style="black on yellow")
elif journal_frequency_for_day == 2:
day_label = Text(day, style="black on green")
else:
day_label = Text(day, style="black on white")
days.append(day_label)
table.add_row(*days)
year_calendar.append(Align.center(table))
# Print year header line
console.rule(str(year))
console.print()
# Print calendar
console.print(Columns(year_calendar, padding=1, expand=True))
return capture.get()
@classmethod
def export_journal(cls, journal: "Journal"):
"""Returns dates and their frequencies for an entire journal."""
journal_entry_date_frequency = get_journal_frequency_nested(journal)
return cls.print_calendar_heatmap(journal_entry_date_frequency)

View file

@ -1,10 +1,10 @@
# Copyright © 2012-2023 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
from collections import Counter
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from jrnl.plugins.text_exporter import TextExporter from jrnl.plugins.text_exporter import TextExporter
from jrnl.plugins.util import get_journal_frequency_one_level
if TYPE_CHECKING: if TYPE_CHECKING:
from jrnl.journals import Entry from jrnl.journals import Entry
@ -24,6 +24,10 @@ class DatesExporter(TextExporter):
@classmethod @classmethod
def export_journal(cls, journal: "Journal") -> str: def export_journal(cls, journal: "Journal") -> str:
"""Returns dates and their frequencies for an entire journal.""" """Returns dates and their frequencies for an entire journal."""
date_counts = get_journal_frequency_one_level(journal) date_counts = Counter()
for entry in journal.entries:
# entry.date.date() gets date without time
date = str(entry.date.date())
date_counts[date] += 1
result = "\n".join(f"{date}, {count}" for date, count in date_counts.items()) result = "\n".join(f"{date}, {count}" for date, count in date_counts.items())
return result return result

View file

@ -1,21 +1,12 @@
# Copyright © 2012-2023 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
from collections import Counter
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
if TYPE_CHECKING: if TYPE_CHECKING:
from jrnl.journals import Journal from jrnl.journals import Journal
class NestedDict(dict):
"""https://stackoverflow.com/a/74873621/8740440"""
def __missing__(self, x):
self[x] = NestedDict()
return self[x]
def get_tags_count(journal: "Journal") -> set[tuple[int, str]]: def get_tags_count(journal: "Journal") -> set[tuple[int, str]]:
"""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 time
@ -38,26 +29,3 @@ def oxford_list(lst: list) -> str:
return lst[0] + " or " + lst[1] return lst[0] + " or " + lst[1]
else: else:
return ", ".join(lst[:-1]) + ", or " + lst[-1] return ", ".join(lst[:-1]) + ", or " + lst[-1]
def get_journal_frequency_nested(journal: "Journal") -> NestedDict:
"""Returns a NestedDict of the form {year: {month: {day: count}}}"""
journal_frequency = NestedDict()
for entry in journal.entries:
date = entry.date.date()
if date.day in journal_frequency[date.year][date.month]:
journal_frequency[date.year][date.month][date.day] += 1
else:
journal_frequency[date.year][date.month][date.day] = 1
return journal_frequency
def get_journal_frequency_one_level(journal: "Journal") -> Counter:
"""Returns a Counter of the form {date (YYYY-MM-DD): count}"""
date_counts = Counter()
for entry in journal.entries:
# entry.date.date() gets date without time
date = str(entry.date.date())
date_counts[date] += 1
return date_counts

150
package-lock.json generated
View file

@ -5,7 +5,7 @@
"packages": { "packages": {
"": { "": {
"devDependencies": { "devDependencies": {
"pa11y-ci": "3.1.0" "pa11y-ci": "3.0.1"
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
@ -25,6 +25,12 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"dev": true
},
"node_modules/agent-base": { "node_modules/agent-base": {
"version": "6.0.2", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@ -68,9 +74,9 @@
} }
}, },
"node_modules/axe-core": { "node_modules/axe-core": {
"version": "4.2.4", "version": "4.4.3",
"resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.2.4.tgz", "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.4.3.tgz",
"integrity": "sha512-9AiDKFKUCWEQm1Kj4lcq7KFavLqSXdf2m/zJo+NVh4VXlW5iwXRJ6alkKmipCyYorsRnqsICH9XLubP1jBF+Og==", "integrity": "sha512-32+ub6kkdhhWick/UjvEwRchgoetXqTK14INLqbGm5U2TzBkBNF3nQtLYm8ovxSkQWArjEQvftCKryjZaATu3w==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=4" "node": ">=4"
@ -519,6 +525,19 @@
"node": ">= 0.4.0" "node": ">= 0.4.0"
} }
}, },
"node_modules/hogan.js": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/hogan.js/-/hogan.js-3.0.2.tgz",
"integrity": "sha512-RqGs4wavGYJWE07t35JQccByczmNUXQT0E12ZYV1VKYu5UiAU9lsos/yBAcf840+zrUQQxgVduCR5/B8nNtibg==",
"dev": true,
"dependencies": {
"mkdirp": "0.3.0",
"nopt": "1.0.10"
},
"bin": {
"hulk": "bin/hulk"
}
},
"node_modules/hoopy": { "node_modules/hoopy": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz", "resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz",
@ -665,6 +684,16 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/mkdirp": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz",
"integrity": "sha512-OHsdUcVAQ6pOtg5JYWpCBo9W/GySVuwvP9hueRMW7UqshC0tbfzLv8wjySTPm3tfUZ/21CE9E1pJagOA91Pxew==",
"deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)",
"dev": true,
"engines": {
"node": "*"
}
},
"node_modules/mkdirp-classic": { "node_modules/mkdirp-classic": {
"version": "0.5.3", "version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
@ -677,15 +706,6 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true "dev": true
}, },
"node_modules/mustache": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
"integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
"dev": true,
"bin": {
"mustache": "bin/mustache"
}
},
"node_modules/node-fetch": { "node_modules/node-fetch": {
"version": "2.6.7", "version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
@ -719,6 +739,21 @@
"node": ">=0.4.0" "node": ">=0.4.0"
} }
}, },
"node_modules/nopt": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
"integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
"dev": true,
"dependencies": {
"abbrev": "1"
},
"bin": {
"nopt": "bin/nopt.js"
},
"engines": {
"node": "*"
}
},
"node_modules/nth-check": { "node_modules/nth-check": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
@ -795,18 +830,18 @@
} }
}, },
"node_modules/pa11y": { "node_modules/pa11y": {
"version": "6.2.3", "version": "6.1.1",
"resolved": "https://registry.npmjs.org/pa11y/-/pa11y-6.2.3.tgz", "resolved": "https://registry.npmjs.org/pa11y/-/pa11y-6.1.1.tgz",
"integrity": "sha512-69JoUlfW2QVmrgQAm+17XBxIvmd1u0ImFBYIHPyjC61CzAkmxO3kkbqDVxIcl0OKLvAMYSMbvfCH8kMFE9xsbg==", "integrity": "sha512-2NzqA3D9CUlDWj8WuOI4fM2P0qM1d/IUxsRRpzCOfDT5eMR1oEgmUwW2TAk+f90ff/GVck0BewdYT4et4BANew==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"axe-core": "~4.2.1", "axe-core": "^4.0.2",
"bfj": "~7.0.2", "bfj": "~7.0.2",
"commander": "~8.0.0", "commander": "~8.0.0",
"envinfo": "~7.8.1", "envinfo": "~7.8.1",
"html_codesniffer": "~2.5.1", "hogan.js": "^3.0.2",
"html_codesniffer": "^2.5.1",
"kleur": "~4.1.4", "kleur": "~4.1.4",
"mustache": "~4.2.0",
"node.extend": "~2.0.2", "node.extend": "~2.0.2",
"p-timeout": "~4.1.0", "p-timeout": "~4.1.0",
"puppeteer": "~9.1.1", "puppeteer": "~9.1.1",
@ -820,19 +855,19 @@
} }
}, },
"node_modules/pa11y-ci": { "node_modules/pa11y-ci": {
"version": "3.1.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/pa11y-ci/-/pa11y-ci-3.1.0.tgz", "resolved": "https://registry.npmjs.org/pa11y-ci/-/pa11y-ci-3.0.1.tgz",
"integrity": "sha512-1WBGBMq0dYtZ+N/SH/AcnFSsT6sZ2w27d8Z/5XHJWSELeX8Qhh4yX5f0drb7crwjt7ugKSo4A7eEF9RbMB0LYg==", "integrity": "sha512-DUtEIhEG3Ofds7qRuplq0DdCb9doILRlzcRctFNzo4QUNmVy4iZfM3u51A9cqoPo2irCJZoo5BzfiFrcriY2IQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"async": "~2.6.4", "async": "~2.6.3",
"cheerio": "~1.0.0-rc.10", "cheerio": "~1.0.0-rc.10",
"commander": "~6.2.1", "commander": "~6.2.1",
"globby": "~6.1.0", "globby": "~6.1.0",
"kleur": "~4.1.4", "kleur": "~4.1.4",
"lodash": "~4.17.21", "lodash": "~4.17.21",
"node-fetch": "~2.6.1", "node-fetch": "~2.6.1",
"pa11y": "^6.2.3", "pa11y": "~6.1.0",
"protocolify": "~3.0.0", "protocolify": "~3.0.0",
"puppeteer": "~9.1.1", "puppeteer": "~9.1.1",
"wordwrap": "~1.0.0" "wordwrap": "~1.0.0"
@ -841,7 +876,7 @@
"pa11y-ci": "bin/pa11y-ci.js" "pa11y-ci": "bin/pa11y-ci.js"
}, },
"engines": { "engines": {
"node": ">= 12" "node": ">=12"
} }
}, },
"node_modules/pa11y/node_modules/commander": { "node_modules/pa11y/node_modules/commander": {
@ -1235,6 +1270,12 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"dev": true
},
"agent-base": { "agent-base": {
"version": "6.0.2", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@ -1269,9 +1310,9 @@
} }
}, },
"axe-core": { "axe-core": {
"version": "4.2.4", "version": "4.4.3",
"resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.2.4.tgz", "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.4.3.tgz",
"integrity": "sha512-9AiDKFKUCWEQm1Kj4lcq7KFavLqSXdf2m/zJo+NVh4VXlW5iwXRJ6alkKmipCyYorsRnqsICH9XLubP1jBF+Og==", "integrity": "sha512-32+ub6kkdhhWick/UjvEwRchgoetXqTK14INLqbGm5U2TzBkBNF3nQtLYm8ovxSkQWArjEQvftCKryjZaATu3w==",
"dev": true "dev": true
}, },
"balanced-match": { "balanced-match": {
@ -1592,6 +1633,16 @@
"function-bind": "^1.1.1" "function-bind": "^1.1.1"
} }
}, },
"hogan.js": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/hogan.js/-/hogan.js-3.0.2.tgz",
"integrity": "sha512-RqGs4wavGYJWE07t35JQccByczmNUXQT0E12ZYV1VKYu5UiAU9lsos/yBAcf840+zrUQQxgVduCR5/B8nNtibg==",
"dev": true,
"requires": {
"mkdirp": "0.3.0",
"nopt": "1.0.10"
}
},
"hoopy": { "hoopy": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz", "resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz",
@ -1693,6 +1744,12 @@
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"mkdirp": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz",
"integrity": "sha512-OHsdUcVAQ6pOtg5JYWpCBo9W/GySVuwvP9hueRMW7UqshC0tbfzLv8wjySTPm3tfUZ/21CE9E1pJagOA91Pxew==",
"dev": true
},
"mkdirp-classic": { "mkdirp-classic": {
"version": "0.5.3", "version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
@ -1705,12 +1762,6 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true "dev": true
}, },
"mustache": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
"integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
"dev": true
},
"node-fetch": { "node-fetch": {
"version": "2.6.7", "version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
@ -1730,6 +1781,15 @@
"is": "^3.2.1" "is": "^3.2.1"
} }
}, },
"nopt": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
"integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
"dev": true,
"requires": {
"abbrev": "1"
}
},
"nth-check": { "nth-check": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
@ -1785,18 +1845,18 @@
"dev": true "dev": true
}, },
"pa11y": { "pa11y": {
"version": "6.2.3", "version": "6.1.1",
"resolved": "https://registry.npmjs.org/pa11y/-/pa11y-6.2.3.tgz", "resolved": "https://registry.npmjs.org/pa11y/-/pa11y-6.1.1.tgz",
"integrity": "sha512-69JoUlfW2QVmrgQAm+17XBxIvmd1u0ImFBYIHPyjC61CzAkmxO3kkbqDVxIcl0OKLvAMYSMbvfCH8kMFE9xsbg==", "integrity": "sha512-2NzqA3D9CUlDWj8WuOI4fM2P0qM1d/IUxsRRpzCOfDT5eMR1oEgmUwW2TAk+f90ff/GVck0BewdYT4et4BANew==",
"dev": true, "dev": true,
"requires": { "requires": {
"axe-core": "~4.2.1", "axe-core": "^4.0.2",
"bfj": "~7.0.2", "bfj": "~7.0.2",
"commander": "~8.0.0", "commander": "~8.0.0",
"envinfo": "~7.8.1", "envinfo": "~7.8.1",
"html_codesniffer": "~2.5.1", "hogan.js": "^3.0.2",
"html_codesniffer": "^2.5.1",
"kleur": "~4.1.4", "kleur": "~4.1.4",
"mustache": "~4.2.0",
"node.extend": "~2.0.2", "node.extend": "~2.0.2",
"p-timeout": "~4.1.0", "p-timeout": "~4.1.0",
"puppeteer": "~9.1.1", "puppeteer": "~9.1.1",
@ -1812,19 +1872,19 @@
} }
}, },
"pa11y-ci": { "pa11y-ci": {
"version": "3.1.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/pa11y-ci/-/pa11y-ci-3.1.0.tgz", "resolved": "https://registry.npmjs.org/pa11y-ci/-/pa11y-ci-3.0.1.tgz",
"integrity": "sha512-1WBGBMq0dYtZ+N/SH/AcnFSsT6sZ2w27d8Z/5XHJWSELeX8Qhh4yX5f0drb7crwjt7ugKSo4A7eEF9RbMB0LYg==", "integrity": "sha512-DUtEIhEG3Ofds7qRuplq0DdCb9doILRlzcRctFNzo4QUNmVy4iZfM3u51A9cqoPo2irCJZoo5BzfiFrcriY2IQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"async": "~2.6.4", "async": "~2.6.3",
"cheerio": "~1.0.0-rc.10", "cheerio": "~1.0.0-rc.10",
"commander": "~6.2.1", "commander": "~6.2.1",
"globby": "~6.1.0", "globby": "~6.1.0",
"kleur": "~4.1.4", "kleur": "~4.1.4",
"lodash": "~4.17.21", "lodash": "~4.17.21",
"node-fetch": "~2.6.1", "node-fetch": "~2.6.1",
"pa11y": "^6.2.3", "pa11y": "~6.1.0",
"protocolify": "~3.0.0", "protocolify": "~3.0.0",
"puppeteer": "~9.1.1", "puppeteer": "~9.1.1",
"wordwrap": "~1.0.0" "wordwrap": "~1.0.0"

View file

@ -1,5 +1,5 @@
{ {
"devDependencies": { "devDependencies": {
"pa11y-ci": "3.1.0" "pa11y-ci": "3.0.1"
} }
} }

1530
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "jrnl" name = "jrnl"
version = "v4.2.1" version = "v4.1-beta2"
description = "Collect your thoughts and notes without leaving the command line." description = "Collect your thoughts and notes without leaving the command line."
authors = [ authors = [
"jrnl contributors <maintainers@jrnl.sh>", "jrnl contributors <maintainers@jrnl.sh>",
@ -27,7 +27,7 @@ classifiers = [
"Funding" = "https://opencollective.com/jrnl" "Funding" = "https://opencollective.com/jrnl"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = ">=3.10.0, <3.14" python = ">=3.10.0, <3.13"
colorama = ">=0.4" # https://github.com/tartley/colorama/blob/master/CHANGELOG.rst colorama = ">=0.4" # https://github.com/tartley/colorama/blob/master/CHANGELOG.rst
cryptography = ">=3.0" # https://cryptography.io/en/latest/api-stability.html cryptography = ">=3.0" # https://cryptography.io/en/latest/api-stability.html
@ -36,19 +36,19 @@ parsedatetime = ">=2.6"
python-dateutil = "^2.8" # https://github.com/dateutil/dateutil/blob/master/RELEASING python-dateutil = "^2.8" # https://github.com/dateutil/dateutil/blob/master/RELEASING
pyxdg = ">=0.27.0" pyxdg = ">=0.27.0"
"ruamel.yaml" = ">=0.17.22" "ruamel.yaml" = ">=0.17.22"
rich = ">=14.0.0, <14.1.0" rich = ">=12.2.0, <14.0.0"
# dayone-only deps # dayone-only deps
tzlocal = ">=4.0" # https://github.com/regebro/tzlocal/blob/master/CHANGES.txt tzlocal = ">=4.0" # https://github.com/regebro/tzlocal/blob/master/CHANGES.txt
[tool.poetry.group.dev.dependencies] [tool.poetry.dev-dependencies]
black = { version = ">=21.5b2", allow-prereleases = true } black = { version = ">=21.5b2", allow-prereleases = true }
ipdb = "*" ipdb = "*"
mkdocs = ">=1.4" mkdocs = ">=1.4"
parse-type = ">=0.6.0" parse-type = ">=0.6.0"
poethepoet = "*" poethepoet = "*"
pytest = ">=8.1" pytest = ">=6.2"
pytest-bdd = ">=8.0" pytest-bdd = ">=6.0"
pytest-clarity = "*" pytest-clarity = "*"
pytest-xdist = ">=2.5.0" pytest-xdist = ">=2.5.0"
requests = "*" requests = "*"
@ -91,7 +91,7 @@ lint.sequence = [
"poetry --version", "poetry --version",
"poetry check", "poetry check",
"ruff --version", "ruff --version",
"ruff check .", "ruff .",
"black --version", "black --version",
"black --check ." "black --check ."
] ]
@ -130,7 +130,7 @@ line-length = 88
target-version = "py310" target-version = "py310"
# https://beta.ruff.rs/docs/rules/ # https://beta.ruff.rs/docs/rules/
lint.select = [ select = [
'F', # Pyflakes 'F', # Pyflakes
'E', # pycodestyle errors 'E', # pycodestyle errors
'W', # pycodestyle warnings 'W', # pycodestyle warnings
@ -149,11 +149,11 @@ lint.select = [
] ]
exclude = [".git", ".tox", ".venv", "node_modules"] exclude = [".git", ".tox", ".venv", "node_modules"]
[tool.ruff.lint.isort] [tool.ruff.isort]
force-single-line = true force-single-line = true
known-first-party = ["jrnl", "tests"] known-first-party = ["jrnl", "tests"]
[tool.ruff.lint.per-file-ignores] [tool.ruff.per-file-ignores]
"__init__.py" = ["F401"] # unused imports "__init__.py" = ["F401"] # unused imports
[build-system] [build-system]
@ -169,8 +169,8 @@ isolated_build = True
[testenv] [testenv]
deps = deps =
pytest >=8.1 pytest >= 6.2
pytest-bdd >=8.0 pytest-bdd >=6.0
pytest-xdist >=2.5.0 pytest-xdist >=2.5.0
parse-type >=0.6.0 parse-type >=0.6.0
toml >=0.10 toml >=0.10

View file

@ -41,14 +41,7 @@ def generate_pa11y_config_from_sitemap():
urls += [url["loc"] for url in xml_sitemap["urlset"]["url"]] urls += [url["loc"] for url in xml_sitemap["urlset"]["url"]]
with open(CONFIG_FILENAME, "w") as f: with open(CONFIG_FILENAME, "w") as f:
f.write( f.write(json.dumps({"urls": urls}))
json.dumps(
{
"defaults": {"chromeLaunchConfig": {"args": ["--no-sandbox"]}},
"urls": urls,
}
)
)
def output_file(file): def output_file(file):

View file

@ -8,20 +8,16 @@ Feature: Test combinations of edit, change-time, and delete
And we write nothing to the editor if opened And we write nothing to the editor if opened
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time '2022-04-23 10:30' --edit" and enter When we run "jrnl --change-time '2022-04-23 10:30' --edit" and enter
"""
Y Y
N N
Y Y
"""
Then the error output should contain "No text received from editor. Were you trying to delete all the entries?" Then the error output should contain "No text received from editor. Were you trying to delete all the entries?"
And the editor should have been called And the editor should have been called
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 2020-08-31 14:32 A second entry in what I hope to be a long series.
2022-04-23 10:30 Entry the first. 2022-04-23 10:30 Entry the first.
2022-04-23 10:30 The third entry finally after weeks without writing. 2022-04-23 10:30 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -33,16 +29,12 @@ Feature: Test combinations of edit, change-time, and delete
Scenario Outline: --delete with --edit deletes selected entries Scenario Outline: --delete with --edit deletes selected entries
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we append to the editor if opened And we append to the editor if opened
"""
[2023-02-21 10:32] Here is a new entry [2023-02-21 10:32] Here is a new entry
"""
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --delete --edit" and enter When we run "jrnl --delete --edit" and enter
"""
Y Y
N N
Y Y
"""
Then the editor should have been called Then the editor should have been called
And the error output should contain "3 entries found" And the error output should contain "3 entries found"
And the error output should contain "2 entries deleted" And the error output should contain "2 entries deleted"
@ -50,10 +42,8 @@ Feature: Test combinations of edit, change-time, and delete
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the error output should contain "2 entries found" Then the error output should contain "2 entries found"
And the output should be And the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 2020-08-31 14:32 A second entry in what I hope to be a long series.
2023-02-21 10:32 Here is a new entry 2023-02-21 10:32 Here is a new entry
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -67,23 +57,19 @@ Feature: Test combinations of edit, change-time, and delete
And we use the password "test" if prompted And we use the password "test" if prompted
# --change-time is asked first, then --delete # --change-time is asked first, then --delete
When we run "jrnl --change-time '2022-04-23 10:30' --delete" and enter When we run "jrnl --change-time '2022-04-23 10:30' --delete" and enter
"""
N N
N N
Y Y
Y Y
N N
N N
"""
Then the error output should contain "3 entries found" Then the error output should contain "3 entries found"
And the error output should contain "1 entry deleted" And the error output should contain "1 entry deleted"
And the error output should contain "1 entry modified" And the error output should contain "1 entry modified"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 2020-08-31 14:32 A second entry in what I hope to be a long series.
2022-04-23 10:30 The third entry finally after weeks without writing. 2022-04-23 10:30 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -95,30 +81,24 @@ Feature: Test combinations of edit, change-time, and delete
Scenario Outline: Combining --change-time and --delete and --edit affects appropriate entries Scenario Outline: Combining --change-time and --delete and --edit affects appropriate entries
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we append to the editor if opened And we append to the editor if opened
""" [2023-02-21 10:32] Here is a new entry
[2023-02-21 10:32] Here is a new entry
"""
And we use the password "test" if prompted And we use the password "test" if prompted
# --change-time is asked first, then --delete, then --edit # --change-time is asked first, then --delete, then --edit
When we run "jrnl --change-time '2022-04-23 10:30' --delete --edit" and enter When we run "jrnl --change-time '2022-04-23 10:30' --delete --edit" and enter
"""
N N
Y Y
Y Y
Y Y
Y Y
N N
"""
Then the error output should contain "3 entries found" Then the error output should contain "3 entries found"
And the error output should contain "2 entries deleted" And the error output should contain "2 entries deleted"
And the error output should contain "1 entry modified" And the error output should contain "1 entry modified" # only 1, because the other was deleted
And the error output should contain "1 entry added" And the error output should contain "1 entry added" # by edit
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2022-04-23 10:30 The third entry finally after weeks without writing. 2022-04-23 10:30 The third entry finally after weeks without writing.
2023-02-21 10:32 Here is a new entry 2023-02-21 10:32 Here is a new entry
"""
Examples: Configs Examples: Configs
| config_file | | config_file |

View file

@ -8,18 +8,14 @@ Feature: Change entry times in journal
When we run "jrnl -1" When we run "jrnl -1"
Then the output should contain "2020-09-24 09:14 The third entry finally" Then the output should contain "2020-09-24 09:14 The third entry finally"
When we run "jrnl -1 --change-time '2022-04-23 10:30'" and enter When we run "jrnl -1 --change-time '2022-04-23 10:30'" and enter
"""
Y Y
"""
Then the error output should contain "1 entry modified" Then the error output should contain "1 entry modified"
And the error output should not contain "deleted" And the error output should not contain "deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-08-31 14:32 A second entry in what I hope to be a long series.
2022-04-23 10:30 The third entry finally after weeks without writing. 2022-04-23 10:30 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -33,26 +29,20 @@ Feature: Change entry times in journal
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --short" When we run "jrnl --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-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. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
When we run "jrnl --change-time '2022-04-23 10:30'" and enter When we run "jrnl --change-time '2022-04-23 10:30'" and enter
"""
Y Y
N N
Y Y
"""
Then the error output should contain "3 entries found" Then the error output should contain "3 entries found"
And the error output should contain "2 entries modified" And the error output should contain "2 entries modified"
When we run "jrnl --short" When we run "jrnl --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 2020-08-31 14:32 A second entry in what I hope to be a long series.
2022-04-23 10:30 Entry the first. 2022-04-23 10:30 Entry the first.
2022-04-23 10:30 The third entry finally after weeks without writing. 2022-04-23 10:30 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -68,18 +58,14 @@ Feature: Change entry times in journal
When we run "jrnl -1" When we run "jrnl -1"
Then the output should contain "2020-09-24 09:14 The third entry finally" Then the output should contain "2020-09-24 09:14 The third entry finally"
When we run "jrnl -1 --change-time '2023-02-21 10:30'" and enter When we run "jrnl -1 --change-time '2023-02-21 10:30'" and enter
"""
N N
"""
Then the error output should not contain "modified" Then the error output should not contain "modified"
And the error output should not contain "deleted" And the error output should not contain "deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-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. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -97,11 +83,9 @@ Feature: Change entry times in journal
And the error output should not contain "entries deleted" And the error output should not contain "entries deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-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. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -115,18 +99,14 @@ Feature: Change entry times in journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time '2022-04-23 10:30' @ipsum" and enter When we run "jrnl --change-time '2022-04-23 10:30' @ipsum" and enter
"""
Y Y
"""
Then the error output should contain "1 entry found" Then the error output should contain "1 entry found"
And the error output should contain "1 entry modified" And the error output should contain "1 entry modified"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 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. 2020-09-24 09:14 The third entry finally after weeks without writing.
2022-04-23 10:30 Entry the first. 2022-04-23 10:30 Entry the first.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -140,17 +120,13 @@ Feature: Change entry times in journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time '2022-04-23 10:30' @ipsum @tagthree" and enter When we run "jrnl --change-time '2022-04-23 10:30' @ipsum @tagthree" and enter
"""
Y Y
Y Y
"""
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 2020-08-31 14:32 A second entry in what I hope to be a long series.
2022-04-23 10:30 Entry the first. 2022-04-23 10:30 Entry the first.
2022-04-23 10:30 The third entry finally after weeks without writing. 2022-04-23 10:30 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -164,16 +140,12 @@ Feature: Change entry times in journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time '2022-04-23 10:30' -and @tagone @tagtwo" and enter When we run "jrnl --change-time '2022-04-23 10:30' -and @tagone @tagtwo" and enter
"""
Y Y
"""
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 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. 2020-09-24 09:14 The third entry finally after weeks without writing.
2022-04-23 10:30 Entry the first. 2022-04-23 10:30 Entry the first.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -187,16 +159,12 @@ Feature: Change entry times in journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time '2022-04-23 10:30' @tagone -not @ipsum" and enter When we run "jrnl --change-time '2022-04-23 10:30' @tagone -not @ipsum" and enter
"""
Y Y
"""
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-08-31 14:32 A second entry in what I hope to be a long series.
2022-04-23 10:30 The third entry finally after weeks without writing. 2022-04-23 10:30 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -210,16 +178,12 @@ Feature: Change entry times in journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time '2022-04-23 10:30' -from 2020-09-01" and enter When we run "jrnl --change-time '2022-04-23 10:30' -from 2020-09-01" and enter
"""
Y Y
"""
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-08-31 14:32 A second entry in what I hope to be a long series.
2022-04-23 10:30 The third entry finally after weeks without writing. 2022-04-23 10:30 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -233,17 +197,13 @@ Feature: Change entry times in journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time '2022-04-23 10:30' -to 2020-08-31" and enter When we run "jrnl --change-time '2022-04-23 10:30' -to 2020-08-31" and enter
"""
Y Y
Y Y
"""
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-09-24 09:14 The third entry finally after weeks without writing. 2020-09-24 09:14 The third entry finally after weeks without writing.
2022-04-23 10:30 Entry the first. 2022-04-23 10:30 Entry the first.
2022-04-23 10:30 A second entry in what I hope to be a long series. 2022-04-23 10:30 A second entry in what I hope to be a long series.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -257,16 +217,12 @@ Feature: Change entry times in journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time '2022-04-23 10:30' -starred" and enter When we run "jrnl --change-time '2022-04-23 10:30' -starred" and enter
"""
Y Y
"""
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 2020-08-29 11:11 Entry the first.
2020-09-24 09:14 The third entry finally after weeks without writing. 2020-09-24 09:14 The third entry finally after weeks without writing.
2022-04-23 10:30 A second entry in what I hope to be a long series. 2022-04-23 10:30 A second entry in what I hope to be a long series.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -280,17 +236,13 @@ Feature: Change entry times in journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time '2022-04-23 10:30' -contains dignissim" and enter When we run "jrnl --change-time '2022-04-23 10:30' -contains dignissim" and enter
"""
Y Y
"""
Then the error output should contain "1 entry modified" Then the error output should contain "1 entry modified"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 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. 2020-09-24 09:14 The third entry finally after weeks without writing.
2022-04-23 10:30 Entry the first. 2022-04-23 10:30 Entry the first.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -304,18 +256,14 @@ Feature: Change entry times in journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --change-time" and enter When we run "jrnl --change-time" and enter
"""
N N
N N
N N
"""
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-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. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |

View file

@ -7,8 +7,8 @@ Feature: Multiple journals
Given the config "basic_onefile.yaml" exists Given the config "basic_onefile.yaml" exists
And we use the config "multiple.yaml" And we use the config "multiple.yaml"
When we run "jrnl --cf basic_onefile.yaml -999" When we run "jrnl --cf basic_onefile.yaml -999"
Then the output should not contain "My first entry" Then the output should not contain "My first entry" # from multiple.yaml
And the output should contain "Lorem ipsum" And the output should contain "Lorem ipsum" # from basic_onefile.yaml
Scenario: Write to default journal by default using an alternate config Scenario: Write to default journal by default using an alternate config
Given the config "multiple.yaml" exists Given the config "multiple.yaml" exists
@ -73,22 +73,18 @@ Feature: Multiple journals
Given the config "multiple.yaml" exists Given the config "multiple.yaml" exists
And we use the config "basic_onefile.yaml" And we use the config "basic_onefile.yaml"
When we run "jrnl new_encrypted --cf multiple.yaml Adding first entry" and enter When we run "jrnl new_encrypted --cf multiple.yaml Adding first entry" and enter
"""
these three eyes these three eyes
these three eyes these three eyes
n n
"""
Then the output should contain "Journal 'new_encrypted' created at " Then the output should contain "Journal 'new_encrypted' created at "
Scenario: Don't overwrite main config when encrypting a journal in an alternate config Scenario: Don't overwrite main config when encrypting a journal in an alternate config
Given the config "basic_onefile.yaml" exists Given the config "basic_onefile.yaml" exists
And we use the config "multiple.yaml" And we use the config "multiple.yaml"
When we run "jrnl --cf basic_onefile.yaml --encrypt" and enter When we run "jrnl --cf basic_onefile.yaml --encrypt" and enter
"""
these three eyes these three eyes
these three eyes these three eyes
n n
"""
Then the output should contain "Journal encrypted to features/journals/basic_onefile.journal" Then the output should contain "Journal encrypted to features/journals/basic_onefile.journal"
And the config should contain "encrypt: false" And the config should contain "encrypt: false"
@ -126,7 +122,7 @@ Feature: Multiple journals
And we use the config "duplicate_keys.yaml" And we use the config "duplicate_keys.yaml"
When we run "jrnl -1" When we run "jrnl -1"
Then the output should contain "There is at least one duplicate key in your configuration file" Then the output should contain "There is at least one duplicate key in your configuration file"
Scenario: Show a warning message when using --config-file with duplicate keys Scenario: Show a warning message when using --config-file with duplicate keys
Given the config "duplicate_keys.yaml" exists Given the config "duplicate_keys.yaml" exists
And we use the config "multiple.yaml" And we use the config "multiple.yaml"
@ -142,4 +138,4 @@ Feature: Multiple journals
Given we use the config "format_md.yaml" Given we use the config "format_md.yaml"
When we run "jrnl -1" When we run "jrnl -1"
Then the output should contain "Configuration updated to newest version at" Then the output should contain "Configuration updated to newest version at"
And the version in the config file should be up-to-date And the version in the config file should be up-to-date

View file

@ -27,13 +27,11 @@ Feature: Reading and writing to journal with custom date formats
Then we should get no error Then we should get no error
When we run "jrnl -n 999" When we run "jrnl -n 999"
Then the output should be Then the output should be
"""
09.06.2013 15:39 My first entry. 09.06.2013 15:39 My first entry.
| Everything is alright | Everything is alright
10.07.2013 15:40 Life is good. 10.07.2013 15:40 Life is good.
| But I'm better. | But I'm better.
"""
Scenario Outline: Writing an entry from command line with custom date Scenario Outline: Writing an entry from command line with custom date
@ -144,11 +142,9 @@ Feature: Reading and writing to journal with custom date formats
Given we use the config "mostlyreadabledates.yaml" Given we use the config "mostlyreadabledates.yaml"
When we run "jrnl --short" When we run "jrnl --short"
Then the output should be Then the output should be
"""
2019-07-01 14:23 The third entry 2019-07-01 14:23 The third entry
2019-07-18 14:23 The first entry 2019-07-18 14:23 The first entry
2019-07-19 14:23 The second entry 2019-07-19 14:23 The second entry
"""
Scenario: Update near-valid dates after journal is edited Scenario: Update near-valid dates after journal is edited
@ -179,9 +175,7 @@ Feature: Reading and writing to journal with custom date formats
When we run "jrnl -1" When we run "jrnl -1"
Then we should get no error Then we should get no error
And the output should be And the output should be
"""
2013-10-27 04:27 Some text. 2013-10-27 04:27 Some text.
"""
@skip #1422 @skip #1422

View file

@ -8,19 +8,15 @@ Feature: Delete entries from journal
When we run "jrnl -1" When we run "jrnl -1"
Then the output should contain "2020-09-24 09:14 The third entry finally" Then the output should contain "2020-09-24 09:14 The third entry finally"
When we run "jrnl --delete" and enter When we run "jrnl --delete" and enter
"""
N N
N N
Y Y
"""
Then the error output should contain "3 entries found" Then the error output should contain "3 entries found"
And the error output should contain "1 entry deleted" And the error output should contain "1 entry deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -33,17 +29,13 @@ Feature: Delete entries from journal
Scenario Outline: Backing out of interactive delete does not change journal Scenario Outline: Backing out of interactive delete does not change journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --delete -n 1" and enter When we run "jrnl --delete -n 1" and enter
"""
N N
"""
Then the error output should not contain "deleted" Then the error output should not contain "deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-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. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -58,11 +50,9 @@ Feature: Delete entries from journal
Then the error output should contain "No entries to delete" Then the error output should contain "No entries to delete"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-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. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -74,17 +64,13 @@ Feature: Delete entries from journal
Scenario Outline: Delete flag with tag only deletes tagged entries Scenario Outline: Delete flag with tag only deletes tagged entries
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --delete @ipsum" and enter When we run "jrnl --delete @ipsum" and enter
"""
Y Y
"""
Then the error output should contain "1 entry found" Then the error output should contain "1 entry found"
Then the error output should contain "1 entry deleted" Then the error output should contain "1 entry deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 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. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -96,17 +82,13 @@ Feature: Delete entries from journal
Scenario Outline: Delete flag with multiple tags deletes all entries matching any of the tags Scenario Outline: Delete flag with multiple tags deletes all entries matching any of the tags
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --delete @ipsum @tagthree" and enter When we run "jrnl --delete @ipsum @tagthree" and enter
"""
Y Y
Y Y
"""
Then the error output should contain "2 entries found" Then the error output should contain "2 entries found"
And the error output should contain "2 entries deleted" And the error output should contain "2 entries deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 2020-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -118,17 +100,13 @@ Feature: Delete entries from journal
Scenario Outline: Delete flag with -and deletes boolean AND of tagged entries Scenario Outline: Delete flag with -and deletes boolean AND of tagged entries
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --delete -and @tagone @tagtwo" and enter When we run "jrnl --delete -and @tagone @tagtwo" and enter
"""
Y Y
"""
Then the error output should contain "1 entry found" Then the error output should contain "1 entry found"
And the error output should contain "1 entry deleted" And the error output should contain "1 entry deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 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. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -140,17 +118,13 @@ Feature: Delete entries from journal
Scenario Outline: Delete flag with -not does not delete entries from given tag Scenario Outline: Delete flag with -not does not delete entries from given tag
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --delete @tagone -not @ipsum" and enter When we run "jrnl --delete @tagone -not @ipsum" and enter
"""
Y Y
"""
Then the error output should contain "1 entry found" Then the error output should contain "1 entry found"
And the error output should contain "1 entry deleted" And the error output should contain "1 entry deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -162,17 +136,13 @@ Feature: Delete entries from journal
Scenario Outline: Delete flag with -from search operator only deletes entries since that date Scenario Outline: Delete flag with -from search operator only deletes entries since that date
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --delete -from 2020-09-01" and enter When we run "jrnl --delete -from 2020-09-01" and enter
"""
Y Y
"""
Then the error output should contain "1 entry found" Then the error output should contain "1 entry found"
And the error output should contain "1 entry deleted" And the error output should contain "1 entry deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 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-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -184,17 +154,13 @@ Feature: Delete entries from journal
Scenario Outline: Delete flag with -to only deletes entries up to specified date Scenario Outline: Delete flag with -to only deletes entries up to specified date
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --delete -to 2020-08-31" and enter When we run "jrnl --delete -to 2020-08-31" and enter
"""
Y Y
Y Y
"""
Then the error output should contain "2 entries found" Then the error output should contain "2 entries found"
And the error output should contain "2 entries deleted" And the error output should contain "2 entries deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-09-24 09:14 The third entry finally after weeks without writing. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -206,16 +172,12 @@ Feature: Delete entries from journal
Scenario Outline: Delete flag with -starred only deletes starred entries Scenario Outline: Delete flag with -starred only deletes starred entries
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --delete -starred" and enter When we run "jrnl --delete -starred" and enter
"""
Y Y
"""
Then the error output should contain "1 entry deleted" Then the error output should contain "1 entry deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-29 11:11 Entry the first. 2020-08-29 11:11 Entry the first.
2020-09-24 09:14 The third entry finally after weeks without writing. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |
@ -227,17 +189,13 @@ Feature: Delete entries from journal
Scenario Outline: Delete flag with -contains only entries containing expression Scenario Outline: Delete flag with -contains only entries containing expression
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --delete -contains dignissim" and enter When we run "jrnl --delete -contains dignissim" and enter
"""
Y Y
"""
Then the error output should contain "1 entry found" Then the error output should contain "1 entry found"
And the error output should contain "1 entry deleted" And the error output should contain "1 entry deleted"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2020-08-31 14:32 A second entry in what I hope to be a long series. 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. 2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: Configs Examples: Configs
| config_file | | config_file |

View file

@ -11,10 +11,8 @@ Feature: Encrypting and decrypting journals
And the config for journal "default" should contain "encrypt: false" And the config for journal "default" should contain "encrypt: false"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
@todo @todo
@ -25,10 +23,8 @@ Feature: Encrypting and decrypting journals
Then the config for journal "default" should contain "encrypt: false" Then the config for journal "default" should contain "encrypt: false"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
Scenario: Trying to encrypt an already encrypted journal Scenario: Trying to encrypt an already encrypted journal
@ -40,11 +36,9 @@ Feature: Encrypting and decrypting journals
Scenario Outline: Encrypting a journal Scenario Outline: Encrypting a journal
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
When we run "jrnl --encrypt" and enter When we run "jrnl --encrypt" and enter
"""
swordfish swordfish
swordfish swordfish
n n
"""
Then we should get no error Then we should get no error
And the output should contain "Journal encrypted" And the output should contain "Journal encrypted"
And the config for journal "default" should contain "encrypt: true" And the config for journal "default" should contain "encrypt: true"
@ -56,20 +50,16 @@ Feature: Encrypting and decrypting journals
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
And we don't have a keyring And we don't have a keyring
When we run "jrnl --encrypt" and enter When we run "jrnl --encrypt" and enter
"""
swordfish swordfish
swordfish swordfish
y y
"""
Then we should get no error Then we should get no error
And the output should contain "Journal encrypted" And the output should contain "Journal encrypted"
When we run "jrnl --encrypt" and enter When we run "jrnl --encrypt" and enter
"""
swordfish swordfish
tuna tuna
tuna tuna
y y
"""
Then we should get no error Then we should get no error
And the output should contain "Journal default is already encrypted. Create a new password." And the output should contain "Journal default is already encrypted. Create a new password."
And we should be prompted for a password And we should be prompted for a password
@ -79,19 +69,15 @@ Feature: Encrypting and decrypting journals
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
And we have a keyring And we have a keyring
When we run "jrnl --encrypt" and enter When we run "jrnl --encrypt" and enter
"""
swordfish swordfish
swordfish swordfish
y y
"""
Then we should get no error Then we should get no error
And the output should contain "Journal encrypted" And the output should contain "Journal encrypted"
When we run "jrnl --encrypt" and enter When we run "jrnl --encrypt" and enter
"""
tuna tuna
tuna tuna
y y
"""
Then we should get no error Then we should get no error
And the output should contain "Journal default is already encrypted. Create a new password." And the output should contain "Journal default is already encrypted. Create a new password."
And we should be prompted for a password And we should be prompted for a password

View file

@ -8,9 +8,7 @@ Feature: Journals iteracting with the file system in a way that users can see
When we run "jrnl 23 July 2013: Testing folder journal." When we run "jrnl 23 July 2013: Testing folder journal."
Then we should get no error Then we should get no error
And the journal directory should contain And the journal directory should contain
"""
2013/07/23.txt 2013/07/23.txt
"""
Scenario: Adding multiple entries to a Folder journal should generate multiple date files Scenario: Adding multiple entries to a Folder journal should generate multiple date files
Given we use the config "empty_folder.yaml" Given we use the config "empty_folder.yaml"
@ -18,9 +16,7 @@ Feature: Journals iteracting with the file system in a way that users can see
And we run "jrnl 3/7/2014: Second entry of journal." And we run "jrnl 3/7/2014: Second entry of journal."
Then we should get no error Then we should get no error
And the journal directory should contain And the journal directory should contain
"""
2013/07/23.txt 2013/07/23.txt
"""
Scenario: If the journal and its parent directory don't exist, they should be created Scenario: If the journal and its parent directory don't exist, they should be created
Given we use the config "missing_directory.yaml" Given we use the config "missing_directory.yaml"
@ -37,7 +33,7 @@ Feature: Journals iteracting with the file system in a way that users can see
Then the journal should exist Then the journal should exist
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should contain "This is a new entry in my journal" Then the output should contain "This is a new entry in my journal"
@on_posix @on_posix
Scenario: If the directory for a Folder journal ending in a slash ('/') doesn't exist, then it should be created Scenario: If the directory for a Folder journal ending in a slash ('/') doesn't exist, then it should be created
Given we use the config "missing_directory.yaml" Given we use the config "missing_directory.yaml"
@ -59,11 +55,9 @@ Feature: Journals iteracting with the file system in a way that users can see
Scenario: Creating journal with relative path should update to absolute path Scenario: Creating journal with relative path should update to absolute path
Given we use no config Given we use no config
When we run "jrnl hello world" and enter When we run "jrnl hello world" and enter
"""
test.txt test.txt
n n
\n \n
"""
Then the output should contain "Journal 'default' created" Then the output should contain "Journal 'default' created"
When we change directory to "subfolder" When we change directory to "subfolder"
And we run "jrnl -n 1" And we run "jrnl -n 1"

View file

@ -40,12 +40,10 @@ Feature: Custom formats
Given we parse the output as JSON Given we parse the output as JSON
Then "entries" in the parsed output should have 3 elements Then "entries" in the parsed output should have 3 elements
And "tags" in the parsed output should be And "tags" in the parsed output should be
"""
@ipsum @ipsum
@tagone @tagone
@tagtwo @tagtwo
@tagthree @tagthree
"""
And "entries.0.tags" in the parsed output should have 3 elements And "entries.0.tags" in the parsed output should have 3 elements
And "entries.1.tags" in the parsed output should have 1 elements And "entries.1.tags" in the parsed output should have 1 elements
And "entries.2.tags" in the parsed output should have 2 elements And "entries.2.tags" in the parsed output should have 2 elements
@ -64,9 +62,7 @@ Feature: Custom formats
And the output should be valid JSON And the output should be valid JSON
Given we parse the output as JSON Given we parse the output as JSON
Then "entries.0.uuid" in the parsed output should be Then "entries.0.uuid" in the parsed output should be
"""
4BB1F46946AD439996C9B59DE7C4DDC1 4BB1F46946AD439996C9B59DE7C4DDC1
"""
Scenario Outline: Printing a journal that has multiline entries with tags Scenario Outline: Printing a journal that has multiline entries with tags
Given we use the config "<config_file>" Given we use the config "<config_file>"
@ -74,7 +70,6 @@ Feature: Custom formats
When we run "jrnl -n 1 @ipsum" When we run "jrnl -n 1 @ipsum"
Then we should get no error Then we should get no error
And the output should be And the output should be
"""
2020-08-29 11:11 Entry the first. 2020-08-29 11:11 Entry the first.
| Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada | Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
| quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus | quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus
@ -95,7 +90,6 @@ Feature: Custom formats
| velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac | velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
| porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per | porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
| conubia nostra, per inceptos himenaeos. | conubia nostra, per inceptos himenaeos.
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -114,11 +108,9 @@ Feature: Custom formats
Given we parse the output as JSON Given we parse the output as JSON
Then "entries" in the parsed output should have 2 elements Then "entries" in the parsed output should have 2 elements
And "tags" in the parsed output should be And "tags" in the parsed output should be
"""
@ipsum @ipsum
@tagone @tagone
@tagtwo @tagtwo
"""
And "entries.0.tags" in the parsed output should have 3 elements And "entries.0.tags" in the parsed output should have 3 elements
And "entries.1.tags" in the parsed output should have 1 elements And "entries.1.tags" in the parsed output should have 1 elements
@ -133,7 +125,6 @@ Feature: Custom formats
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
Given we append to the editor if opened Given we append to the editor if opened
"""
[2021-10-14 13:23] Heading Test [2021-10-14 13:23] Heading Test
H1-1 H1-1
@ -176,12 +167,10 @@ Feature: Custom formats
More stuff More stuff
more stuff again more stuff again
"""
When we run "jrnl --edit -1" When we run "jrnl --edit -1"
Then the editor should have been called Then the editor should have been called
When we run "jrnl -1 --export markdown" When we run "jrnl -1 --export markdown"
Then the output should be Then the output should be
"""
# 2021 # 2021
## October ## October
@ -222,7 +211,6 @@ Feature: Custom formats
More stuff More stuff
more stuff again more stuff again
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -239,12 +227,10 @@ Feature: Custom formats
Then the output should be a valid XML string Then the output should be a valid XML string
And "entries" in the xml output should have 3 elements And "entries" in the xml output should have 3 elements
And "tags" in the xml output should contain And "tags" in the xml output should contain
"""
@ipsum @ipsum
@tagone @tagone
@tagtwo @tagtwo
@tagthree @tagthree
"""
And there should be 10 "tag" elements And there should be 10 "tag" elements
Examples: configs Examples: configs
@ -262,11 +248,9 @@ Feature: Custom formats
Given we parse the output as XML Given we parse the output as XML
Then "entries" in the parsed output should have 2 elements Then "entries" in the parsed output should have 2 elements
And "tags" in the parsed output should be And "tags" in the parsed output should be
"""
@idea @idea
@journal @journal
@dan @dan
"""
And there should be 7 "tag" elements And there should be 7 "tag" elements
Scenario Outline: Exporting tags Scenario Outline: Exporting tags
@ -274,12 +258,10 @@ Feature: Custom formats
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --export tags" When we run "jrnl --export tags"
Then the output should be Then the output should be
"""
@tagtwo : 2 @tagtwo : 2
@tagone : 2 @tagone : 2
@tagthree : 1 @tagthree : 1
@ipsum : 1 @ipsum : 1
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -311,7 +293,6 @@ Feature: Custom formats
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --export fancy" When we run "jrnl --export fancy"
Then the output should be Then the output should be
"""
2020-08-29 11:11 2020-08-29 11:11
Entry the first. Entry the first.
@ -394,7 +375,6 @@ Feature: Custom formats
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
ante eget fringilla. @tagthree and also @tagone ante eget fringilla. @tagthree and also @tagone
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -410,14 +390,11 @@ Feature: Custom formats
And we create a cache directory And we create a cache directory
When we run "jrnl --format yaml --file {cache_dir}" When we run "jrnl --format yaml --file {cache_dir}"
Then the cache directory should contain the files Then the cache directory should contain the files
"""
2020-08-29_entry-the-first.md 2020-08-29_entry-the-first.md
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.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 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 And the content of file "2020-08-29_entry-the-first.md" in the cache should be
"""
--- ---
title: Entry the first. title: Entry the first.
date: 2020-08-29 11:11 date: 2020-08-29 11:11
@ -443,8 +420,7 @@ Feature: Custom formats
porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
conubia nostra, per inceptos himenaeos. conubia nostra, per inceptos himenaeos.
... ...
"""
Examples: configs Examples: configs
| config_file | | config_file |
| basic_onefile.yaml | | basic_onefile.yaml |
@ -475,13 +451,10 @@ Feature: Custom formats
And we create a cache directory And we create a cache directory
When we run "jrnl --export yaml -o {cache_dir}" When we run "jrnl --export yaml -o {cache_dir}"
Then the cache should contain the files Then the cache should contain the files
"""
2020-08-29_entry-the-first.md 2020-08-29_entry-the-first.md
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.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 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 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. title: The third entry finally after weeks without writing.
date: 2020-09-24 09:14 date: 2020-09-24 09:14
@ -499,7 +472,6 @@ Feature: Custom formats
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
ante eget fringilla. @tagthree and also @tagone ante eget fringilla. @tagthree and also @tagone
... ...
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -544,7 +516,6 @@ Feature: Custom formats
Given we use the config "format_md.yaml" Given we use the config "format_md.yaml"
When we run "jrnl -n 1" When we run "jrnl -n 1"
Then the output should be Then the output should be
"""
# 2013 # 2013
## June ## June
@ -552,16 +523,13 @@ Feature: Custom formats
### 2013-06-10 15:40 Life is good. ### 2013-06-10 15:40 Life is good.
But I'm better. But I'm better.
"""
Scenario: Text Formatter from config file Scenario: Text Formatter from config file
Given we use the config "format_text.yaml" Given we use the config "format_text.yaml"
When we run "jrnl -n 1" When we run "jrnl -n 1"
Then the output should be Then the output should be
"""
[2013-06-10 15:40] Life is good. [2013-06-10 15:40] Life is good.
But I'm better. But I'm better.
"""
Scenario Outline: Exporting entries with Cyrillic characters to directory should not fail Scenario Outline: Exporting entries with Cyrillic characters to directory should not fail
Given we use the config "<config_file>" Given we use the config "<config_file>"
@ -570,9 +538,7 @@ Feature: Custom formats
When we run "jrnl 2020-11-21: Первая" When we run "jrnl 2020-11-21: Первая"
When we run "jrnl --format md --file {cache_dir} -on 2020-11-21" When we run "jrnl --format md --file {cache_dir} -on 2020-11-21"
Then the cache should contain the files Then the cache should contain the files
"""
2020-11-21_первая.md 2020-11-21_первая.md
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -587,11 +553,9 @@ Feature: Custom formats
When we run "jrnl 2020-08-31 01:01: Hi." When we run "jrnl 2020-08-31 01:01: Hi."
And we run "jrnl --format dates" And we run "jrnl --format dates"
Then the output should be Then the output should be
"""
2020-08-29, 1 2020-08-29, 1
2020-08-31, 2 2020-08-31, 2
2020-09-24, 1 2020-09-24, 1
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -607,7 +571,7 @@ Feature: Custom formats
When we run "jrnl --config-override display_format short -1" When we run "jrnl --config-override display_format short -1"
Then we should get no error Then we should get no error
When we run "jrnl --config-override display_format pretty -1" When we run "jrnl --config-override display_format pretty -1"
Then we should get no error Then we should get no error
Examples: configs Examples: configs
| config_file | | config_file |
@ -624,7 +588,7 @@ Feature: Custom formats
When we run "jrnl --format markdown --file {cache_dir}" When we run "jrnl --format markdown --file {cache_dir}"
Then the cache directory should contain 5 files Then the cache directory should contain 5 files
And we should get no error And we should get no error
Scenario: Export entries in text format with a title longer than max file name length. Scenario: Export entries in text format with a title longer than max file name length.
Given we use the config "basic_onefile.yaml" Given we use the config "basic_onefile.yaml"
And we create a cache directory And we create a cache directory
@ -638,42 +602,30 @@ Feature: Custom formats
Given we use the config "basic_onefile.yaml" Given we use the config "basic_onefile.yaml"
When we run "jrnl --list" When we run "jrnl --list"
Then the output should match Then the output should match
"""
Journals defined in config \(.+basic_onefile\.yaml\) Journals defined in config \(.+basic_onefile\.yaml\)
\* default -> features/journals/basic_onefile\.journal \* default -> features/journals/basic_onefile\.journal
"""
When we run "jrnl --list --format json" When we run "jrnl --list --format json"
Then the output should match Then the output should match
"""
{"config_path": ".+basic_onefile\.yaml", "journals": {"default": "features/journals/basic_onefile\.journal"}} {"config_path": ".+basic_onefile\.yaml", "journals": {"default": "features/journals/basic_onefile\.journal"}}
"""
When we run "jrnl --list --format yaml" When we run "jrnl --list --format yaml"
Then the output should match Then the output should match
"""
config_path: .+basic_onefile\.yaml config_path: .+basic_onefile\.yaml
journals: journals:
default: features/journals/basic_onefile\.journal default: features/journals/basic_onefile\.journal
"""
Scenario: Export journal list to formats with no default journal Scenario: Export journal list to formats with no default journal
Given we use the config "no_default_journal.yaml" Given we use the config "no_default_journal.yaml"
When we run "jrnl --list" When we run "jrnl --list"
Then the output should match Then the output should match
"""
Journals defined in config \(.+no_default_journal\.yaml\) Journals defined in config \(.+no_default_journal\.yaml\)
\* simple -> features/journals/simple\.journal \* simple -> features/journals/simple\.journal
\* work -> features/journals/work\.journal \* work -> features/journals/work\.journal
"""
When we run "jrnl --list --format json" When we run "jrnl --list --format json"
Then the output should match Then the output should match
"""
{"config_path": ".+no_default_journal\.yaml", "journals": {"simple": "features/journals/simple\.journal", "work": "features/journals/work\.journal"}} {"config_path": ".+no_default_journal\.yaml", "journals": {"simple": "features/journals/simple\.journal", "work": "features/journals/work\.journal"}}
"""
When we run "jrnl --list --format yaml" When we run "jrnl --list --format yaml"
Then the output should match Then the output should match
"""
config_path: .+no_default_journal\.yaml config_path: .+no_default_journal\.yaml
journals: journals:
simple: features/journals/simple\.journal simple: features/journals/simple\.journal
work: features/journals/work\.journal work: features/journals/work\.journal
"""

View file

@ -21,7 +21,6 @@ Feature: Importing data
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --import" and pipe When we run "jrnl --import" and pipe
"""
[2020-07-05 15:00] Observe and import. [2020-07-05 15:00] Observe and import.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis
est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque augue est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque augue
@ -29,7 +28,6 @@ Feature: Importing data
Aenean ante ex, elementum ut interdum et, mattis eget lacus. In commodo nulla nec 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 tellus placerat, sed ultricies metus bibendum. Duis eget venenatis erat. In at
dolor dui end of entry. dolor dui end of entry.
"""
When we run "jrnl -on 2020-07-05" When we run "jrnl -on 2020-07-05"
Then the output should contain "2020-07-05 15:00 Observe and import." 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 "Lorem ipsum"
@ -46,13 +44,11 @@ Feature: Importing data
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --import" and pipe When we run "jrnl --import" and pipe
"""
[2020-07-05 15:00] Observe and import. [2020-07-05 15:00] Observe and import.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
[2020-07-05 15:01] Twice as nice. [2020-07-05 15:01] Twice as nice.
Sed dignissim sed nisl eu consequat. Sed dignissim sed nisl eu consequat.
"""
When we run "jrnl -on 2020-07-05" When we run "jrnl -on 2020-07-05"
Then the output should contain "2020-07-05 15:00 Observe and import." 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 "Lorem ipsum"
@ -87,9 +83,7 @@ Feature: Importing data
But the output should not contain "I have an @idea" But the output should not contain "I have an @idea"
And the output should not contain "I met with" And the output should not contain "I met with"
When we run "jrnl --import --file features/journals/tags.journal" and pipe When we run "jrnl --import --file features/journals/tags.journal" and pipe
"""
[2020-07-05 15:00] I should not exist! [2020-07-05 15:00] I should not exist!
"""
And we run "jrnl -99" And we run "jrnl -99"
Then the output should contain "My first entry." Then the output should contain "My first entry."
And the output should contain "PROFIT!" And the output should contain "PROFIT!"

View file

@ -3,11 +3,9 @@ Feature: Installing jrnl
Scenario: Install jrnl with default options Scenario: Install jrnl with default options
Given we use no config Given we use no config
When we run "jrnl hello world" and enter When we run "jrnl hello world" and enter
"""
\n \n
\n \n
\n \n
"""
Then the output should contain "jrnl configuration created at" Then the output should contain "jrnl configuration created at"
And the output should contain "For advanced features, read the docs at https://jrnl.sh" And the output should contain "For advanced features, read the docs at https://jrnl.sh"
And the output should contain "Journal 'default' created" And the output should contain "Journal 'default' created"
@ -18,11 +16,9 @@ Feature: Installing jrnl
Scenario: Install jrnl with custom relative default journal path Scenario: Install jrnl with custom relative default journal path
Given we use no config Given we use no config
When we run "jrnl hello world" and enter When we run "jrnl hello world" and enter
"""
default/custom.txt default/custom.txt
n n
\n \n
"""
Then the output should contain "Journal 'default' created" Then the output should contain "Journal 'default' created"
And the default journal "custom.txt" should be in the "default" directory And the default journal "custom.txt" should be in the "default" directory
And the config should contain "encrypt: false" And the config should contain "encrypt: false"
@ -32,11 +28,9 @@ Feature: Installing jrnl
Given we use no config Given we use no config
And the home directory is called "home" And the home directory is called "home"
When we run "jrnl hello world" and enter When we run "jrnl hello world" and enter
"""
~/custom.txt ~/custom.txt
n n
\n \n
"""
Then the output should contain "Journal 'default' created" Then the output should contain "Journal 'default' created"
And the default journal "custom.txt" should be in the "home" directory And the default journal "custom.txt" should be in the "home" directory
And the config should contain "encrypt: false" And the config should contain "encrypt: false"
@ -45,11 +39,9 @@ Feature: Installing jrnl
Scenario: Install jrnl with encrypted default journal Scenario: Install jrnl with encrypted default journal
Given we use no config Given we use no config
When we run "jrnl hello world" and enter When we run "jrnl hello world" and enter
"""
encrypted.txt encrypted.txt
y y
\n \n
"""
Then the output should contain "Journal will be encrypted" Then the output should contain "Journal will be encrypted"
And the default journal "encrypted.txt" should be in the "." directory And the default journal "encrypted.txt" should be in the "." directory
And the config should contain "encrypt: true" And the config should contain "encrypt: true"
@ -60,58 +52,46 @@ Feature: Installing jrnl
Scenario: Install jrnl with colors by default Scenario: Install jrnl with colors by default
Given we use no config Given we use no config
When we run "jrnl hello world" and enter When we run "jrnl hello world" and enter
"""
\n \n
\n \n
\n \n
"""
Then the output should contain "Journal 'default' created" Then the output should contain "Journal 'default' created"
And the config should contain And the config should contain
"""
colors: colors:
body: none body: none
date: black date: black
tags: yellow tags: yellow
title: cyan title: cyan
"""
Scenario: Install jrnl without colors Scenario: Install jrnl without colors
Given we use no config Given we use no config
When we run "jrnl hello world" and enter When we run "jrnl hello world" and enter
"""
\n \n
\n \n
N N
"""
Then the output should contain "Journal 'default' created" Then the output should contain "Journal 'default' created"
And the config should contain And the config should contain
"""
colors: colors:
body: none body: none
date: none date: none
tags: none tags: none
title: none title: none
"""
Scenario: Install jrnl with encrypted default journal with no entries Scenario: Install jrnl with encrypted default journal with no entries
Given we use no config Given we use no config
When we run "jrnl -1" and enter When we run "jrnl -1" and enter
"""
encrypted.txt encrypted.txt
y y
n n
test test
test test
n n
"""
Then the error output should contain "Journal will be encrypted" Then the error output should contain "Journal will be encrypted"
And the default journal "encrypted.txt" should be in the "." directory And the default journal "encrypted.txt" should be in the "." directory
And the config should contain "encrypt: true" And the config should contain "encrypt: true"
And the version in the config file should be up-to-date And the version in the config file should be up-to-date
When we run "jrnl -1" and enter When we run "jrnl -1" and enter
""" test
test
"""
Then we should be prompted for a password Then we should be prompted for a password
And the error output should contain "no entries found" And the error output should contain "no entries found"
And the error output should not contain "Wrong password, try again" And the error output should not contain "Wrong password, try again"

View file

@ -7,10 +7,8 @@ Feature: Multiple journals
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
When we run "jrnl work -99 --short" When we run "jrnl work -99 --short"
Then the output should be empty Then the output should be empty
@ -19,14 +17,10 @@ Feature: Multiple journals
When we run "jrnl this goes to default" When we run "jrnl this goes to default"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should contain Then the output should contain
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
Then the output should contain Then the output should contain
"""
this goes to default this goes to default
"""
When we run "jrnl work -99 --short" When we run "jrnl work -99 --short"
Then the output should be empty Then the output should be empty
@ -35,10 +29,8 @@ Feature: Multiple journals
When we run "jrnl work a long day in the office" When we run "jrnl work a long day in the office"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
When we run "jrnl work -99 --short" When we run "jrnl work -99 --short"
Then the output should contain "a long day in the office" Then the output should contain "a long day in the office"
@ -52,44 +44,32 @@ Feature: Multiple journals
When we run "jrnl work 23 july 2012: a long day in the office" When we run "jrnl work 23 july 2012: a long day in the office"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
When we run "jrnl work -99 --short" When we run "jrnl work -99 --short"
Then the output should be Then the output should be
"""
2012-07-23 09:00 a long day in the office 2012-07-23 09:00 a long day in the office
"""
Scenario: Write to specified journal without a timestamp but with colon Scenario: Write to specified journal without a timestamp but with colon
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl work : a long day in the office" When we run "jrnl work : a long day in the office"
Then the output should be Then the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
When we run "jrnl work -99 --short" When we run "jrnl work -99 --short"
Then the output should be contain Then the output should be contain
"""
a long day in the office a long day in the office
"""
Scenario: Write to specified journal without a timestamp but with colon Scenario: Write to specified journal without a timestamp but with colon
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl work: a long day in the office" When we run "jrnl work: a long day in the office"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
When we run "jrnl work -99 --short" When we run "jrnl work -99 --short"
Then the output should contain Then the output should contain
"""
a long day in the office a long day in the office
"""
Scenario: Create new journals as required Scenario: Create new journals as required
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
@ -97,9 +77,7 @@ Feature: Multiple journals
When we run "jrnl ideas 23 july 2012: sell my junk on ebay and make lots of money" When we run "jrnl ideas 23 july 2012: sell my junk on ebay and make lots of money"
When we run "jrnl ideas -99 --short" When we run "jrnl ideas -99 --short"
Then the output should be Then the output should be
"""
2012-07-23 09:00 sell my junk on ebay and make lots of money 2012-07-23 09:00 sell my junk on ebay and make lots of money
"""
Scenario: Don't crash if no default journal is specified Scenario: Don't crash if no default journal is specified
Given we use the config "no_default_journal.yaml" Given we use the config "no_default_journal.yaml"
@ -109,11 +87,9 @@ Feature: Multiple journals
Scenario: Don't crash if no file exists for a configured encrypted journal Scenario: Don't crash if no file exists for a configured encrypted journal
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl new_encrypted Adding first entry" and enter When we run "jrnl new_encrypted Adding first entry" and enter
"""
these three eyes these three eyes
these three eyes these three eyes
n n
"""
Then the output should contain "Journal 'new_encrypted' created at" Then the output should contain "Journal 'new_encrypted' created at"
Scenario: Read and write to journal with emoji name Scenario: Read and write to journal with emoji name

View file

@ -7,9 +7,7 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
Given we use the config "basic_encrypted.yaml" Given we use the config "basic_encrypted.yaml"
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl --config-override editor ''" and type When we run "jrnl --config-override editor ''" and type
""" This is a journal entry
This is a journal entry
"""
Then the stdin prompt should have been called Then the stdin prompt should have been called
And the editor should not have been called And the editor should not have been called
When we run "jrnl -1" When we run "jrnl -1"
@ -29,7 +27,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl -2 --config-override linewrap 23 --format fancy" When we run "jrnl -2 --config-override linewrap 23 --format fancy"
Then the output should be Then the output should be
"""
2013-06-09 15:39 2013-06-09 15:39
My My
fir st ent ry. fir st ent ry.
@ -43,7 +40,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
But I'm better. But I'm better.
"""
Scenario: Override color selections with runtime overrides Scenario: Override color selections with runtime overrides
@ -63,14 +59,12 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
And we use the password "test" if prompted And we use the password "test" if prompted
When we run "jrnl -1 --config-override colors.body green --config-override editor 'nano'" When we run "jrnl -1 --config-override colors.body green --config-override editor 'nano'"
Then the config in memory should contain Then the config in memory should contain
"""
editor: nano editor: nano
colors: colors:
title: none title: none
body: green body: green
tags: none tags: none
date: none date: none
"""
Scenario: Override default journal Scenario: Override default journal
@ -80,7 +74,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
Then we should get no error Then we should get no error
When we run "jrnl -3 --config-override journals.default features/journals/simple.journal" When we run "jrnl -3 --config-override journals.default features/journals/simple.journal"
Then the output should be Then the output should be
"""
2000-03-20 09:00 The rain in Spain comes from clouds 2000-03-20 09:00 The rain in Spain comes from clouds
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
@ -88,7 +81,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
| But I'm better. | But I'm better.
"""
Scenario: Make an entry into an overridden journal Scenario: Make an entry into an overridden journal
@ -99,7 +91,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
And the output should contain "Entry added" And the output should contain "Entry added"
When we run "jrnl --config-override journals.temp features/journals/simple.journal temp -3" When we run "jrnl --config-override journals.temp features/journals/simple.journal temp -3"
Then the output should be Then the output should be
"""
1969-09-06 09:00 @say Ni 1969-09-06 09:00 @say Ni
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
@ -107,4 +98,3 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
| But I'm better. | But I'm better.
"""

View file

@ -7,11 +7,9 @@ Feature: Using the installed keyring
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
And we have a keyring And we have a keyring
When we run "jrnl simple --encrypt" and enter When we run "jrnl simple --encrypt" and enter
"""
sabertooth sabertooth
sabertooth sabertooth
Y Y
"""
Then the config for journal "simple" should contain "encrypt: true" Then the config for journal "simple" should contain "encrypt: true"
When we run "jrnl simple -n 1" When we run "jrnl simple -n 1"
Then the output should contain "2013-06-10 15:40 Life is good" Then the output should contain "2013-06-10 15:40 Life is good"
@ -21,11 +19,9 @@ Feature: Using the installed keyring
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
When we run "jrnl test entry" When we run "jrnl test entry"
And we run "jrnl --encrypt" and enter And we run "jrnl --encrypt" and enter
"""
password password
password password
n n
"""
Then we should get no error Then we should get no error
And the output should not contain "Failed to retrieve keyring" And the output should not contain "Failed to retrieve keyring"
@ -34,11 +30,9 @@ Feature: Using the installed keyring
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
When we run "jrnl test entry" When we run "jrnl test entry"
And we run "jrnl --encrypt" and enter And we run "jrnl --encrypt" and enter
"""
password password
password password
y y
"""
Then we should get no error Then we should get no error
And the output should not contain "Failed to retrieve keyring" And the output should not contain "Failed to retrieve keyring"
# @todo add step to check contents of keyring # @todo add step to check contents of keyring
@ -61,11 +55,9 @@ Feature: Using the installed keyring
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
And we have a failed keyring And we have a failed keyring
When we run "jrnl --encrypt" and enter When we run "jrnl --encrypt" and enter
"""
this password will not be saved in keyring this password will not be saved in keyring
this password will not be saved in keyring this password will not be saved in keyring
y y
"""
Then the output should contain "Failed to retrieve keyring" Then the output should contain "Failed to retrieve keyring"
And we should get no error And we should get no error
And we should be prompted for a password And we should be prompted for a password
@ -85,10 +77,8 @@ Feature: Using the installed keyring
When we run "jrnl --short" When we run "jrnl --short"
Then we should not be prompted for a password Then we should not be prompted for a password
And the output should be And the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
Scenario: Open encrypted journal when keyring exists but fails Scenario: Open encrypted journal when keyring exists but fails
@ -106,31 +96,25 @@ Feature: Using the installed keyring
Scenario: Mistyping your password Scenario: Mistyping your password
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
When we run "jrnl --encrypt" and enter When we run "jrnl --encrypt" and enter
"""
swordfish swordfish
sordfish sordfish
"""
Then we should be prompted for a password Then we should be prompted for a password
And the output should contain "Passwords did not match" And the output should contain "Passwords did not match"
And the config for journal "default" should not contain "encrypt: true" And the config for journal "default" should not contain "encrypt: true"
When we run "jrnl --short" When we run "jrnl --short"
Then the output should be Then the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
"""
Scenario: Mistyping your password, then getting it right Scenario: Mistyping your password, then getting it right
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
When we run "jrnl --encrypt" and enter When we run "jrnl --encrypt" and enter
"""
swordfish swordfish
sordfish sordfish
swordfish swordfish
swordfish swordfish
n n
"""
Then we should be prompted for a password Then we should be prompted for a password
And the output should contain "Passwords did not match" And the output should contain "Passwords did not match"
And the output should contain "Journal encrypted" And the output should contain "Journal encrypted"

View file

@ -27,7 +27,7 @@ Feature: Searching in a journal
When we run "jrnl tomorrow: A future entry." When we run "jrnl tomorrow: A future entry."
Then we should get no error Then we should get no error
When we run "jrnl -from today" When we run "jrnl -from today"
Then the output should contain "2 entries found" Then the output should contain "2 entries found"
And the output should contain "Adding an entry right now." And the output should contain "Adding an entry right now."
And the output should contain "A future entry." And the output should contain "A future entry."
And the output should not contain "This thing happened yesterday" And the output should not contain "This thing happened yesterday"
@ -65,9 +65,7 @@ Feature: Searching in a journal
Then we should get no error Then we should get no error
And the output should contain "1 entry found" And the output should contain "1 entry found"
And the output should be And the output should be
"""
2020-08-29 11:11 Entry the first. 2020-08-29 11:11 Entry the first.
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -88,40 +86,6 @@ Feature: Searching in a journal
| basic_folder.yaml | | basic_folder.yaml |
| basic_dayone.yaml | | basic_dayone.yaml |
Scenario Outline: Multiple -contains returns entries that match any
Given we use the config "<config_file>"
When we run "jrnl -contains emojis -contains lorem --short"
Then we should get no error
And the output should contain "3 entries found"
And 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_file |
| basic_onefile.yaml |
| basic_folder.yaml |
| basic_dayone.yaml |
Scenario Outline: Multiple -contains with -and returns only entries that match all
Given we use the config "<config_file>"
When we run "jrnl -contains emojis -contains nulla -and --short"
Then we should get no error
And the output should contain "1 entry found"
And the output should be
"""
2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Examples: configs
| config_file |
| basic_onefile.yaml |
| basic_folder.yaml |
| basic_dayone.yaml |
Scenario Outline: Searching for a string within tag results Scenario Outline: Searching for a string within tag results
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl @tagone -contains maybe" When we run "jrnl @tagone -contains maybe"
@ -225,23 +189,19 @@ Feature: Searching in a journal
Then we should get no error Then we should get no error
When we run "jrnl -2" When we run "jrnl -2"
Then the output should be Then the output should be
"""
2013-07-23 09:00 Testing folder journal. 2013-07-23 09:00 Testing folder journal.
2014-03-07 16:37 Second entry of journal. 2014-03-07 16:37 Second entry of journal.
"""
Scenario Outline: Searching for all tags should show counts of each tag Scenario Outline: Searching for all tags should show counts of each tag
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --tags" When we run "jrnl --tags"
Then we should get no error Then we should get no error
And the output should be And the output should be
"""
@tagtwo : 2 @tagtwo : 2
@tagone : 2 @tagone : 2
@tagthree : 1 @tagthree : 1
@ipsum : 1 @ipsum : 1
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -254,10 +214,8 @@ Feature: Searching in a journal
When we run "jrnl -from 'september 2020' --tags" When we run "jrnl -from 'september 2020' --tags"
Then we should get no error Then we should get no error
And the output should be And the output should be
"""
@tagthree : 1 @tagthree : 1
@tagone : 1 @tagone : 1
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -269,10 +227,8 @@ Feature: Searching in a journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --tags -not @tagtwo" When we run "jrnl --tags -not @tagtwo"
Then the output should be Then the output should be
"""
@tagthree : 1 @tagthree : 1
@tagone : 1 @tagone : 1
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -284,9 +240,7 @@ Feature: Searching in a journal
Given we use the config "<config_file>" Given we use the config "<config_file>"
When we run "jrnl --tags -not @tagone -not @tagthree" When we run "jrnl --tags -not @tagone -not @tagthree"
Then the output should be Then the output should be
"""
@tagtwo : 1 @tagtwo : 1
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -318,13 +272,11 @@ Feature: Searching in a journal
When we run "jrnl -2" When we run "jrnl -2"
Then we should get no error Then we should get no error
And the output should be And the output should be
"""
2013-06-09 15:39 My first entry. 2013-06-09 15:39 My first entry.
| Everything is alright | Everything is alright
2013-06-10 15:40 Life is good. 2013-06-10 15:40 Life is good.
| But I'm better. | But I'm better.
"""
Scenario Outline: Searching by month Scenario Outline: Searching by month
Given we use the config "<config_file>" Given we use the config "<config_file>"
@ -399,10 +351,8 @@ Feature: Searching in a journal
And we run "jrnl -today-in-history --short" And we run "jrnl -today-in-history --short"
Then the output should contain "2 entries found" Then the output should contain "2 entries found"
And the output should be And the output should be
"""
2019-08-31 01:01 Hi, from last year. 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. 2020-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -417,13 +367,11 @@ Feature: Searching in a journal
Then we should get no error Then we should get no error
And the output should contain "3 entries found" And the output should contain "3 entries found"
And the output should be And the output should be
"""
2013-05-17 11:39 This entry has tags! 2013-05-17 11:39 This entry has tags!
2013-06-17 20:38 This entry has a location. 2013-06-17 20:38 This entry has a location.
2013-07-17 11:38 This entry is starred! 2013-07-17 11:38 This entry is starred!
"""
Scenario Outline: Searching the most recent entry should not show found count Scenario Outline: Searching the most recent entry should not show found count
Given we use the config "<config_file>" Given we use the config "<config_file>"

View file

@ -11,11 +11,9 @@ Feature: Tagging
When we run "jrnl --tags -on 2020-09-26" When we run "jrnl --tags -on 2020-09-26"
Then we should get no error Then we should get no error
And the output should be And the output should be
"""
@os/2 : 1 @os/2 : 1
@c++ : 1 @c++ : 1
@c# : 1 @c# : 1
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -43,10 +41,8 @@ Feature: Tagging
When we run "jrnl 2020-09-26: @foo came over, we went to a @bar" When we run "jrnl 2020-09-26: @foo came over, we went to a @bar"
When we run "jrnl --tags -on 2020-09-26" When we run "jrnl --tags -on 2020-09-26"
Then the output should be Then the output should be
"""
@foo : 1 @foo : 1
@bar : 1 @bar : 1
"""
Examples: configs Examples: configs
| config_file | | config_file |

View file

@ -2,13 +2,12 @@
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
Feature: Using templates Feature: Using templates
Scenario Outline: Template contents should be used in new entry Scenario Outline: Template contents should be used in new entry
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
And we append to the editor if opened And we append to the editor if opened
"""
This is an addition to a templated entry This is an addition to a templated entry
"""
When we run "jrnl --config-override template features/templates/basic.template" When we run "jrnl --config-override template features/templates/basic.template"
And we run "jrnl -1" And we run "jrnl -1"
Then the output should contain "This text is in the basic template" Then the output should contain "This text is in the basic template"

View file

@ -8,27 +8,19 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x
When we run "jrnl -9" and enter "Y" When we run "jrnl -9" and enter "Y"
When we run "jrnl -99 --short" When we run "jrnl -99 --short"
Then the output should be Then the output should be
"""
2010-06-10 15:00 A life without chocolate is like a bad analogy. 2010-06-10 15:00 A life without chocolate is like a bad analogy.
2013-06-10 15:40 He said "[this] is the best time to be alive".Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada 2013-06-10 15:40 He said "[this] is the best time to be alive".Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
"""
And the output should contain And the output should contain
"""
2010-06-10 15:00 A life without chocolate is like a bad analogy. 2010-06-10 15:00 A life without chocolate is like a bad analogy.
"""
And the output should contain And the output should contain
"""
2013-06-10 15:40 He said "[this] is the best time to be alive". 2013-06-10 15:40 He said "[this] is the best time to be alive".
"""
Scenario: Upgrading a journal encrypted with jrnl 1.x Scenario: Upgrading a journal encrypted with jrnl 1.x
Given we use the config "encrypted_old.json" Given we use the config "encrypted_old.json"
When we run "jrnl -n 1" and enter When we run "jrnl -n 1" and enter
"""
Y Y
bad doggie no biscuit bad doggie no biscuit
bad doggie no biscuit bad doggie no biscuit
"""
Then we should be prompted for a password Then we should be prompted for a password
And the output should contain "2013-06-10 15:40 Life is good" And the output should contain "2013-06-10 15:40 Life is good"
@ -36,22 +28,18 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x
Given we use the config "no_colors.yaml" Given we use the config "no_colors.yaml"
When we run "jrnl -n 1" When we run "jrnl -n 1"
Then the config should contain Then the config should contain
"""
colors: colors:
date: none date: none
title: none title: none
body: none body: none
tags: none tags: none
"""
Scenario: Upgrade and parse journals with little endian date format Scenario: Upgrade and parse journals with little endian date format
Given we use the config "upgrade_from_195_little_endian_dates.json" Given we use the config "upgrade_from_195_little_endian_dates.json"
When we run "jrnl -9 --short" and enter "Y" When we run "jrnl -9 --short" and enter "Y"
Then the output should contain Then the output should contain
"""
10.06.2010 15:00 A life without chocolate is like a bad analogy. 10.06.2010 15:00 A life without chocolate is like a bad analogy.
10.06.2013 15:40 He said "[this] is the best time to be alive". 10.06.2013 15:40 He said "[this] is the best time to be alive".
"""
Scenario: Upgrade with missing journal Scenario: Upgrade with missing journal
Given we use the config "upgrade_from_195_with_missing_journal.json" Given we use the config "upgrade_from_195_with_missing_journal.json"
@ -62,10 +50,8 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x
Scenario: Upgrade with missing encrypted journal Scenario: Upgrade with missing encrypted journal
Given we use the config "upgrade_from_195_with_missing_encrypted_journal.json" Given we use the config "upgrade_from_195_with_missing_encrypted_journal.json"
When we run "jrnl --list" and enter When we run "jrnl --list" and enter
"""
Y Y
bad doggie no biscuit bad doggie no biscuit
"""
Then the output should contain "features/journals/missing.journal does not exist" Then the output should contain "features/journals/missing.journal does not exist"
And the output should contain "We're all done" And the output should contain "We're all done"
And we should get no error And we should get no error

View file

@ -67,9 +67,7 @@ Feature: Writing new entries.
Then we should get no error Then we should get no error
Then the editor should have been called Then the editor should have been called
And the editor file content should be And the editor file content should be
"""
this is a partial this is a partial
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -148,10 +146,8 @@ Feature: Writing new entries.
Then we should get no error Then we should get no error
When we run "jrnl -1" When we run "jrnl -1"
Then the output should be Then the output should be
"""
2014-04-24 09:00 Created a new website - empty.com. 2014-04-24 09:00 Created a new website - empty.com.
| Hope to get a lot of traffic. | Hope to get a lot of traffic.
"""
Examples: configs Examples: configs
| config_file | | config_file |
@ -210,17 +206,13 @@ Feature: Writing new entries.
Given we parse the output as JSON Given we parse the output as JSON
Then "entries" in the parsed output should have 5 elements Then "entries" in the parsed output should have 5 elements
And "entries.0.creator" in the parsed output should be And "entries.0.creator" in the parsed output should be
"""
software_agent software_agent
os_agent os_agent
host_name host_name
generation_date generation_date
device_agent device_agent
"""
And "entries.0.creator.software_agent" in the parsed output should contain And "entries.0.creator.software_agent" in the parsed output should contain
"""
jrnl jrnl
"""
Scenario: Title with an embedded period on DayOne journal Scenario: Title with an embedded period on DayOne journal
Given we use the config "dayone.yaml" Given we use the config "dayone.yaml"
@ -228,10 +220,8 @@ Feature: Writing new entries.
Then we should get no error Then we should get no error
When we run "jrnl -1" When we run "jrnl -1"
Then the output should be Then the output should be
"""
2014-04-24 09:00 Ran 6.2 miles today in 1:02:03. 2014-04-24 09:00 Ran 6.2 miles today in 1:02:03.
| I am feeling sore because I forgot to stretch. | I am feeling sore because I forgot to stretch.
"""
Scenario: Opening an folder that's not a DayOne folder should treat as folder journal Scenario: Opening an folder that's not a DayOne folder should treat as folder journal
Given we use the config "empty_folder.yaml" Given we use the config "empty_folder.yaml"
@ -244,9 +234,7 @@ Feature: Writing new entries.
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
And we append to the editor if opened And we append to the editor if opened
"""
[2021-11-13] worked on jrnl tests [2021-11-13] worked on jrnl tests
"""
When we run "jrnl --edit" When we run "jrnl --edit"
Then the error output should contain "3 entries found" Then the error output should contain "3 entries found"
And the error output should contain "1 entry added" And the error output should contain "1 entry added"
@ -264,11 +252,9 @@ Feature: Writing new entries.
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
And we append to the editor if opened And we append to the editor if opened
"""
[2021-11-11] worked on jrnl tests [2021-11-11] worked on jrnl tests
[2021-11-12] worked on jrnl tests again [2021-11-12] worked on jrnl tests again
[2021-11-13] worked on jrnl tests a little bit more [2021-11-13] worked on jrnl tests a little bit more
"""
When we run "jrnl --edit" When we run "jrnl --edit"
Then the error output should contain "3 entries found" Then the error output should contain "3 entries found"
And the error output should contain "3 entries added" And the error output should contain "3 entries added"
@ -285,9 +271,7 @@ Feature: Writing new entries.
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
And we write to the editor if opened And we write to the editor if opened
"""
[2021-11-13] I am replacing my whole journal with this entry [2021-11-13] I am replacing my whole journal with this entry
"""
When we run "jrnl --edit" When we run "jrnl --edit"
Then the output should contain "2 entries deleted" Then the output should contain "2 entries deleted"
And the output should contain "1 entry modified" And the output should contain "1 entry modified"
@ -304,9 +288,7 @@ Feature: Writing new entries.
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
And we write to the editor if opened And we write to the editor if opened
"""
[2021-11-13] I am replacing the last entry with this entry [2021-11-13] I am replacing the last entry with this entry
"""
When we run "jrnl --edit -1" When we run "jrnl --edit -1"
Then the error output should contain "1 entry modified" Then the error output should contain "1 entry modified"
@ -322,9 +304,7 @@ Feature: Writing new entries.
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
And we append to the editor if opened And we append to the editor if opened
"""
This is a small addendum to my latest entry. This is a small addendum to my latest entry.
"""
When we run "jrnl --edit" When we run "jrnl --edit"
Then the error output should contain "3 entries found" Then the error output should contain "3 entries found"
And the error output should contain "1 entry modified" And the error output should contain "1 entry modified"
@ -361,16 +341,12 @@ Feature: Writing new entries.
Given we use the config "<config_file>" Given we use the config "<config_file>"
And we use the password "test" if prompted And we use the password "test" if prompted
And we append to the editor if opened And we append to the editor if opened
"""
@newtag @newtag
"""
When we run "jrnl --edit -1" When we run "jrnl --edit -1"
Then the error output should contain "1 entry modified" Then the error output should contain "1 entry modified"
When we run "jrnl --tags @newtag" When we run "jrnl --tags @newtag"
Then the output should contain Then the output should contain
"""
1 entry found 1 entry found
"""
Examples: configs Examples: configs
| config_file | | config_file |

View file

@ -9,11 +9,10 @@ import string
from datetime import datetime from datetime import datetime
from unittest.mock import MagicMock from unittest.mock import MagicMock
from unittest.mock import patch from unittest.mock import patch
from xml.etree import ElementTree as ET from xml.etree import ElementTree
from pytest_bdd import given from pytest_bdd import given
from pytest_bdd.parsers import parse from pytest_bdd.parsers import parse
from pytest_bdd.parsers import re
from jrnl import __version__ from jrnl import __version__
from jrnl.time import __get_pdt_calendar from jrnl.time import __get_pdt_calendar
@ -22,11 +21,7 @@ from tests.lib.fixtures import NoKeyring
from tests.lib.fixtures import TestKeyring from tests.lib.fixtures import TestKeyring
@given(re(r"we (?P<editor_method>\w+) to the editor if opened")) @given(parse("we {editor_method} to the editor if opened\n{editor_input}"))
def we_enter_editor_docstring(editor_method, editor_state, docstring):
we_enter_editor(editor_method, docstring, editor_state)
@given(parse("we {editor_method} nothing to the editor if opened")) @given(parse("we {editor_method} nothing to the editor if opened"))
def we_enter_editor(editor_method, editor_input, editor_state): def we_enter_editor(editor_method, editor_input, editor_state):
file_method = editor_state["intent"]["method"] file_method = editor_state["intent"]["method"]
@ -173,7 +168,7 @@ def parse_output_as_language(cli_run, language_name):
actual_output = cli_run["stdout"] actual_output = cli_run["stdout"]
if language_name == "XML": if language_name == "XML":
parsed_output = ET.fromstring(actual_output) parsed_output = ElementTree.fromstring(actual_output)
elif language_name == "JSON": elif language_name == "JSON":
parsed_output = json.loads(actual_output) parsed_output = json.loads(actual_output)
else: else:

View file

@ -4,11 +4,10 @@
import json import json
import os import os
import re import re
from xml.etree import ElementTree as ET from xml.etree import ElementTree
from pytest_bdd import then from pytest_bdd import then
from pytest_bdd.parsers import parse from pytest_bdd.parsers import parse
from pytest_bdd.parsers import re as pytest_bdd_parsers_re
from ruamel.yaml import YAML from ruamel.yaml import YAML
from jrnl.config import scope_config from jrnl.config import scope_config
@ -31,11 +30,7 @@ def should_get_an_error(cli_run):
assert cli_run["status"] != 0, cli_run["status"] assert cli_run["status"] != 0, cli_run["status"]
@then(parse("the output should match")) @then(parse("the output should match\n{regex}"))
def output_should_match_docstring(cli_run, docstring):
output_should_match(docstring, cli_run)
@then(parse('the output should match "{regex}"')) @then(parse('the output should match "{regex}"'))
def output_should_match(regex, cli_run): def output_should_match(regex, cli_run):
out = cli_run["stdout"] out = cli_run["stdout"]
@ -43,18 +38,14 @@ def output_should_match(regex, cli_run):
assert matches, f"\nRegex didn't match:\n{regex}\n{str(out)}\n{str(matches)}" assert matches, f"\nRegex didn't match:\n{regex}\n{str(out)}\n{str(matches)}"
@then(parse("the output {it_should:Should} contain", SHOULD_DICT)) @then(parse("the output {it_should:Should} contain\n{expected}", SHOULD_DICT))
@then(parse('the output {it_should:Should} contain "{expected}"', SHOULD_DICT))
@then( @then(
parse( parse(
"the {which_output_stream} output {it_should:Should} contain", "the {which_output_stream} output {it_should:Should} contain\n{expected}",
SHOULD_DICT, SHOULD_DICT,
) )
) )
def output_should_contain_docstring(which_output_stream, cli_run, it_should, docstring):
output_should_contain(docstring, which_output_stream, cli_run, it_should)
@then(parse('the output {it_should:Should} contain "{expected}"', SHOULD_DICT))
@then( @then(
parse( parse(
'the {which_output_stream} output {it_should:Should} contain "{expected}"', 'the {which_output_stream} output {it_should:Should} contain "{expected}"',
@ -84,21 +75,13 @@ def output_should_contain(expected, which_output_stream, cli_run, it_should):
assert (expected in cli_run[which_output_stream]) == it_should, output_str assert (expected in cli_run[which_output_stream]) == it_should, output_str
@then(parse("the output should not contain")) @then(parse("the output should not contain\n{expected_output}"))
def output_should_not_contain_docstring(cli_run, docstring):
output_should_not_contain(docstring, cli_run)
@then(parse('the output should not contain "{expected_output}"')) @then(parse('the output should not contain "{expected_output}"'))
def output_should_not_contain(expected_output, cli_run): def output_should_not_contain(expected_output, cli_run):
assert expected_output not in cli_run["stdout"] assert expected_output not in cli_run["stdout"]
@then(parse("the output should be")) @then(parse("the output should be\n{expected_output}"))
def output_should_be_docstring(cli_run, docstring):
output_should_be(docstring, cli_run)
@then(parse('the output should be "{expected_output}"')) @then(parse('the output should be "{expected_output}"'))
def output_should_be(expected_output, cli_run): def output_should_be(expected_output, cli_run):
actual = cli_run["stdout"].strip() actual = cli_run["stdout"].strip()
@ -154,17 +137,6 @@ def default_journal_location(journal_file, journal_dir, config_on_disk, temp_dir
assert os.path.samefile(default_journal_path, expected_journal_path) assert os.path.samefile(default_journal_path, expected_journal_path)
@then(
parse(
'the config for journal "{journal_name}" {it_should:Should} contain',
SHOULD_DICT,
)
)
@then(parse("the config {it_should:Should} contain", SHOULD_DICT))
def config_var_on_disk_docstring(config_on_disk, journal_name, it_should, docstring):
config_var_on_disk(config_on_disk, journal_name, it_should, docstring)
@then( @then(
parse( parse(
'the config for journal "{journal_name}" ' 'the config for journal "{journal_name}" '
@ -172,7 +144,15 @@ def config_var_on_disk_docstring(config_on_disk, journal_name, it_should, docstr
SHOULD_DICT, SHOULD_DICT,
) )
) )
@then(
parse(
'the config for journal "{journal_name}" '
"{it_should:Should} contain\n{some_yaml}",
SHOULD_DICT,
)
)
@then(parse('the config {it_should:Should} contain "{some_yaml}"', SHOULD_DICT)) @then(parse('the config {it_should:Should} contain "{some_yaml}"', SHOULD_DICT))
@then(parse("the config {it_should:Should} contain\n{some_yaml}", SHOULD_DICT))
def config_var_on_disk(config_on_disk, journal_name, it_should, some_yaml): def config_var_on_disk(config_on_disk, journal_name, it_should, some_yaml):
actual = config_on_disk actual = config_on_disk
if journal_name: if journal_name:
@ -188,20 +168,6 @@ def config_var_on_disk(config_on_disk, journal_name, it_should, some_yaml):
assert (expected == actual_slice) == it_should assert (expected == actual_slice) == it_should
@then(
parse(
'the config in memory for journal "{journal_name}" '
"{it_should:Should} contain",
SHOULD_DICT,
)
)
@then(parse("the config in memory {it_should:Should} contain", SHOULD_DICT))
def config_var_in_memory_docstring(
config_in_memory, journal_name, it_should, docstring
):
config_var_in_memory(config_in_memory, journal_name, it_should, docstring)
@then( @then(
parse( parse(
'the config in memory for journal "{journal_name}" ' 'the config in memory for journal "{journal_name}" '
@ -209,9 +175,19 @@ def config_var_in_memory_docstring(
SHOULD_DICT, SHOULD_DICT,
) )
) )
@then(
parse(
'the config in memory for journal "{journal_name}" '
"{it_should:Should} contain\n{some_yaml}",
SHOULD_DICT,
)
)
@then( @then(
parse('the config in memory {it_should:Should} contain "{some_yaml}"', SHOULD_DICT) parse('the config in memory {it_should:Should} contain "{some_yaml}"', SHOULD_DICT)
) )
@then(
parse("the config in memory {it_should:Should} contain\n{some_yaml}", SHOULD_DICT)
)
def config_var_in_memory(config_in_memory, journal_name, it_should, some_yaml): def config_var_in_memory(config_in_memory, journal_name, it_should, some_yaml):
actual = config_in_memory["overrides"] actual = config_in_memory["overrides"]
if journal_name: if journal_name:
@ -237,23 +213,21 @@ def password_was_not_called(cli_run):
assert not cli_run["mocks"]["user_input"].return_value.input.called assert not cli_run["mocks"]["user_input"].return_value.input.called
@then(parse("the cache directory should contain the files")) @then(parse("the cache directory should contain the files\n{file_list}"))
def assert_dir_contains_files(cache_dir, docstring): def assert_dir_contains_files(file_list, cache_dir):
assert does_directory_contain_files(docstring, cache_dir["path"]) assert does_directory_contain_files(file_list, cache_dir["path"])
@then( @then(parse("the cache directory should contain {number} files"))
pytest_bdd_parsers_re(r"the cache directory should contain (?P<number>\d+) files")
)
def assert_dir_contains_n_files(cache_dir, number): def assert_dir_contains_n_files(cache_dir, number):
assert does_directory_contain_n_files(cache_dir["path"], number) assert does_directory_contain_n_files(cache_dir["path"], number)
@then(parse("the journal directory should contain")) @then(parse("the journal directory should contain\n{file_list}"))
def journal_directory_should_contain(config_on_disk, docstring): def journal_directory_should_contain(config_on_disk, file_list):
scoped_config = scope_config(config_on_disk, "default") scoped_config = scope_config(config_on_disk, "default")
assert does_directory_contain_files(docstring, scoped_config["journal"]) assert does_directory_contain_files(file_list, scoped_config["journal"])
@then(parse('journal "{journal_name}" should not exist')) @then(parse('journal "{journal_name}" should not exist'))
@ -288,10 +262,10 @@ def directory_should_not_exist(config_on_disk, it_should, journal_name):
assert dir_exists == it_should assert dir_exists == it_should
@then(parse('the content of file "{file_path}" in the cache should be')) @then(parse('the content of file "{file_path}" in the cache should be\n{file_content}'))
def content_of_file_should_be(file_path, cache_dir, docstring): def content_of_file_should_be(file_path, file_content, cache_dir):
assert cache_dir["exists"] assert cache_dir["exists"]
expected_content = docstring.strip().splitlines() expected_content = file_content.strip().splitlines()
with open(os.path.join(cache_dir["path"], file_path), "r") as f: with open(os.path.join(cache_dir["path"], file_path), "r") as f:
actual_content = f.read().strip().splitlines() actual_content = f.read().strip().splitlines()
@ -308,12 +282,12 @@ def content_of_file_should_be(file_path, cache_dir, docstring):
] ]
@then(parse("the cache should contain the files")) @then(parse("the cache should contain the files\n{file_list}"))
def cache_dir_contains_files(cache_dir, docstring): def cache_dir_contains_files(file_list, cache_dir):
assert cache_dir["exists"] assert cache_dir["exists"]
actual_files = os.listdir(cache_dir["path"]) actual_files = os.listdir(cache_dir["path"])
expected_files = docstring.split("\n") expected_files = file_list.split("\n")
# sort to deal with inconsistent default file ordering on different OS's # sort to deal with inconsistent default file ordering on different OS's
actual_files.sort() actual_files.sort()
@ -326,7 +300,7 @@ def cache_dir_contains_files(cache_dir, docstring):
def assert_output_is_valid_language(cli_run, language_name): def assert_output_is_valid_language(cli_run, language_name):
language_name = language_name.upper() language_name = language_name.upper()
if language_name == "XML": if language_name == "XML":
xml_tree = ET.fromstring(cli_run["stdout"]) xml_tree = ElementTree.fromstring(cli_run["stdout"])
assert xml_tree, "Invalid XML" assert xml_tree, "Invalid XML"
elif language_name == "JSON": elif language_name == "JSON":
assert json.loads(cli_run["stdout"]), "Invalid JSON" assert json.loads(cli_run["stdout"]), "Invalid JSON"
@ -362,11 +336,11 @@ def assert_parsed_output_item_count(node_name, number, parsed_output):
assert False, f"Language name {lang} not recognized" assert False, f"Language name {lang} not recognized"
@then(parse('"{field_name}" in the parsed output should {comparison}')) @then(parse('"{field_name}" in the parsed output should {comparison}\n{expected_keys}'))
def assert_output_field_content(field_name, comparison, parsed_output, docstring): def assert_output_field_content(field_name, comparison, expected_keys, parsed_output):
lang = parsed_output["lang"] lang = parsed_output["lang"]
obj = parsed_output["obj"] obj = parsed_output["obj"]
expected_keys = docstring.split("\n") expected_keys = expected_keys.split("\n")
if len(expected_keys) == 1: if len(expected_keys) == 1:
expected_keys = expected_keys[0] expected_keys = expected_keys[0]
@ -416,7 +390,7 @@ def assert_output_field_content(field_name, comparison, parsed_output, docstring
@then(parse('there should be {number:d} "{item}" elements')) @then(parse('there should be {number:d} "{item}" elements'))
def count_elements(number, item, cli_run): def count_elements(number, item, cli_run):
actual_output = cli_run["stdout"] actual_output = cli_run["stdout"]
xml_tree = ET.fromstring(actual_output) xml_tree = ElementTree.fromstring(actual_output)
assert len(xml_tree.findall(".//" + item)) == number assert len(xml_tree.findall(".//" + item)) == number
@ -446,13 +420,9 @@ def editor_filename_suffix(suffix, editor_state):
assert editor_state["tmpfile"]["name"].endswith(suffix), (editor_filename, suffix) assert editor_state["tmpfile"]["name"].endswith(suffix), (editor_filename, suffix)
@then(parse("the editor file content should {comparison}"))
def contains_editor_file_docstring(comparison, editor_state, docstring):
contains_editor_file(comparison, docstring, editor_state)
@then(parse('the editor file content should {comparison} "{str_value}"')) @then(parse('the editor file content should {comparison} "{str_value}"'))
@then(parse("the editor file content should {comparison} empty")) @then(parse("the editor file content should {comparison} empty"))
@then(parse("the editor file content should {comparison}\n{str_value}"))
def contains_editor_file(comparison, str_value, editor_state): def contains_editor_file(comparison, str_value, editor_state):
content = editor_state["tmpfile"]["content"] content = editor_state["tmpfile"]["content"]
# content = f'\n"""\n{content}\n"""\n' # content = f'\n"""\n{content}\n"""\n'

View file

@ -7,13 +7,7 @@ from contextlib import ExitStack
from pytest_bdd import when from pytest_bdd import when
from pytest_bdd.parsers import parse from pytest_bdd.parsers import parse
from pytest_bdd.parsers import re from pytest_bdd.parsers import re
from pytest_bdd.steps import inject_fixture
# This is an undocumented and unsupported function:
# https://github.com/pytest-dev/pytest-bdd/issues/684
try:
from pytest_bdd.compat import inject_fixture # pytest_bdd 7.1.2 and later
except ImportError:
from pytest_bdd.steps import inject_fixture # pytest_bdd 7.1.1 and earlier
from jrnl.main import run from jrnl.main import run
@ -34,11 +28,7 @@ all_input = '("(?P<all_input>[^"]*)")'
# an empty line of input internally for testing purposes. # an empty line of input internally for testing purposes.
@when(re(f'we run "jrnl {command}" and {input_method}')) @when(parse('we run "jrnl {command}" and {input_method}\n{all_input}'))
def we_run_jrnl_docstring(capsys, keyring, request, command, input_method, docstring):
we_run_jrnl(capsys, keyring, request, command, input_method, docstring)
@when(re(f'we run "jrnl ?{command}" and {input_method} {all_input}')) @when(re(f'we run "jrnl ?{command}" and {input_method} {all_input}'))
@when(re(f'we run "jrnl {command}"(?! and)')) @when(re(f'we run "jrnl {command}"(?! and)'))
@when('we run "jrnl"') @when('we run "jrnl"')

View file

@ -6,6 +6,9 @@ from unittest import mock
import pytest import pytest
from jrnl.exception import JrnlException from jrnl.exception import JrnlException
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability
from jrnl.plugins.yaml_exporter import YAMLExporter from jrnl.plugins.yaml_exporter import YAMLExporter
@ -33,8 +36,12 @@ class TestFancy:
class TestYaml: class TestYaml:
@mock.patch("jrnl.plugins.yaml_exporter.YAMLExporter.export_journal")
@mock.patch("builtins.open") @mock.patch("builtins.open")
def test_export_to_nonexisting_folder(self, mock_open): def test_export_to_nonexisting_folder(self, mock_open, mock_export_journal):
mock_export_journal.side_effect = JrnlException(
Message(MsgText.YamlMustBeDirectory, MsgStyle.ERROR)
)
with pytest.raises(JrnlException): with pytest.raises(JrnlException):
YAMLExporter.write_file("journal", "non-existing-path") YAMLExporter.write_file("journal", "non-existing-path")
mock_open.assert_not_called() mock_open.assert_not_called()

View file

@ -55,7 +55,7 @@ def test_empty():
def test_contains_alone(): def test_contains_alone():
assert cli_as_dict("-contains whatever") == expected_args(contains=["whatever"]) assert cli_as_dict("-contains whatever") == expected_args(contains="whatever")
def test_debug_alone(): def test_debug_alone():
@ -296,7 +296,7 @@ class TestDeserialization:
) )
def test_deserialize_multiword_strings(self, input_str): def test_deserialize_multiword_strings(self, input_str):
runtime_config = make_yaml_valid_dict(input_str) runtime_config = make_yaml_valid_dict(input_str)
assert runtime_config.__class__ is dict assert runtime_config.__class__ == dict
assert input_str[0] in runtime_config assert input_str[0] in runtime_config
assert runtime_config[input_str[0]] == input_str[1] assert runtime_config[input_str[0]] == input_str[1]