diff --git a/CHANGELOG.md b/CHANGELOG.md index 72eb0379..88b1286d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [Unreleased](https://github.com/jrnl-org/jrnl/) + +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7...HEAD) + +**Implemented enhancements:** + +- Allow timestamps in command line for new entries with editor [\#1083](https://github.com/jrnl-org/jrnl/issues/1083) + +**Fixed bugs:** + +- Make journal selection behavior more consistent when there's a colon with no date [\#1164](https://github.com/jrnl-org/jrnl/pull/1164) ([wren](https://github.com/wren)) + +**Packaging:** + +- Bump keyring from 21.8.0 to 22.0.1 [\#1168](https://github.com/jrnl-org/jrnl/pull/1168) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump pytest from 6.2.1 to 6.2.2 [\#1167](https://github.com/jrnl-org/jrnl/pull/1167) ([dependabot[bot]](https://github.com/apps/dependabot)) + ## [v2.7](https://pypi.org/project/jrnl/v2.7/) (2021-01-23) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7-beta...v2.7) diff --git a/README.md b/README.md index bc295f6c..55202436 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ jrnl [![Testing](https://github.com/jrnl-org/jrnl/workflows/Testing/badge.svg)](https://github.com/jrnl-org/jrnl/actions?query=workflow%3ATesting) [![Downloads](https://pepy.tech/badge/jrnl)](https://pepy.tech/project/jrnl) [![Version](http://img.shields.io/pypi/v/jrnl.svg?style=flat)](https://pypi.python.org/pypi/jrnl/) + [![Homebrew](https://img.shields.io/homebrew/v/jrnl?style=flat-square)](https://formulae.brew.sh/formula/jrnl) + [![Gitter](https://img.shields.io/gitter/room/jrnl-org/jrnl)](https://gitter.im/jrnl-org/jrnl) ==== _To get help, [submit an issue](https://github.com/jrnl-org/jrnl/issues/new/choose) on diff --git a/features/multiple_journals.feature b/features/multiple_journals.feature index 6a9efe78..222be100 100644 --- a/features/multiple_journals.feature +++ b/features/multiple_journals.feature @@ -29,6 +29,20 @@ Feature: Multiple journals And journal "work" should have 1 entry And journal "work" should contain "2012-07-23" + Scenario: Write to specified journal without a timestamp but with colon + Given we use the config "multiple.yaml" + When we run "jrnl work : a long day in the office" + Then journal "default" should have 2 entries + And journal "work" should have 1 entry + And journal "work" should contain "a long day in the office" + + Scenario: Write to specified journal without a timestamp but with colon + Given we use the config "multiple.yaml" + When we run "jrnl work: a long day in the office" + Then journal "default" should have 2 entries + And journal "work" should have 1 entry + And journal "work" should contain "a long day in the office" + Scenario: Create new journals as required Given we use the config "multiple.yaml" Then journal "ideas" should not exist diff --git a/jrnl/config.py b/jrnl/config.py index 9e57de3d..a5a1d1cc 100644 --- a/jrnl/config.py +++ b/jrnl/config.py @@ -138,10 +138,18 @@ def update_config(config, new_config, scope, force_local=False): def get_journal_name(args, config): args.journal_name = DEFAULT_JOURNAL_KEY - if args.text and args.text[0] in config["journals"]: - args.journal_name = args.text[0] - args.text = args.text[1:] - elif DEFAULT_JOURNAL_KEY not in config["journals"]: + + # The first arg might be a journal name + if args.text: + potential_journal_name = args.text[0] + if potential_journal_name[-1] == ":": + potential_journal_name = potential_journal_name[0:-1] + + if potential_journal_name in config["journals"]: + args.journal_name = potential_journal_name + args.text = args.text[1:] + + if args.journal_name not in config["journals"]: print("No default journal configured.", file=sys.stderr) print(list_journals(config), file=sys.stderr) sys.exit(1) diff --git a/poetry.lock b/poetry.lock index df676e25..3d7f28f6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -947,14 +947,8 @@ pyparsing = [ pytest = [ {file = "pytest-6.2.2-py3-none-any.whl", hash = "sha256:b574b57423e818210672e07ca1fa90aaf194a4f63f3ab909a2c67ebb22913839"}, {file = "pytest-6.2.2.tar.gz", hash = "sha256:9d1edf9e7d0b84d72ea3dbcdfd22b35fb543a5e8f2a60092dd578936bf63d7f9"}, -] -pytest-cov = [ - {file = "pytest-cov-2.11.1.tar.gz", hash = "sha256:359952d9d39b9f822d9d29324483e7ba04a3a17dd7d05aa6beb7ea01e359e5f7"}, - {file = "pytest_cov-2.11.1-py2.py3-none-any.whl", hash = "sha256:bdb9fdb0b85a7cc825269a4c56b48ccaa5c7e365054b6038772c32ddcdc969da"}, -] -pytest-mock = [ - {file = "pytest-mock-3.5.1.tar.gz", hash = "sha256:a1e2aba6af9560d313c642dae7e00a2a12b022b80301d9d7fc8ec6858e1dd9fc"}, - {file = "pytest_mock-3.5.1-py3-none-any.whl", hash = "sha256:379b391cfad22422ea2e252bdfc008edd08509029bcde3c25b2c0bd741e0424e"}, + + ] python-dateutil = [ {file = "python-dateutil-2.8.1.tar.gz", hash = "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"},