mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 21:18:32 +02:00
Merge branch 'develop' into black
This commit is contained in:
commit
e984a9a015
2 changed files with 33 additions and 32 deletions
|
@ -61,11 +61,12 @@ def open_journal(journal_name="default"):
|
||||||
config = util.load_config(install.CONFIG_FILE_PATH)
|
config = util.load_config(install.CONFIG_FILE_PATH)
|
||||||
journal_conf = config["journals"][journal_name]
|
journal_conf = config["journals"][journal_name]
|
||||||
|
|
||||||
# We can override the default config on a by-journal basis
|
|
||||||
if type(journal_conf) is dict:
|
if type(journal_conf) is dict:
|
||||||
|
# We can override the default config on a by-journal basis
|
||||||
config.update(journal_conf)
|
config.update(journal_conf)
|
||||||
# But also just give them a string to point to the journal file
|
|
||||||
else:
|
else:
|
||||||
|
# But also just give them a string to point to the journal file
|
||||||
config["journal"] = journal_conf
|
config["journal"] = journal_conf
|
||||||
|
|
||||||
return Journal.open_journal(journal_name, config)
|
return Journal.open_journal(journal_name, config)
|
||||||
|
@ -129,11 +130,13 @@ def run_with_input(context, command, inputs=""):
|
||||||
text = iter([inputs])
|
text = iter([inputs])
|
||||||
|
|
||||||
args = ushlex(command)[1:]
|
args = ushlex(command)[1:]
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
# black needs the 'on' and 'off' to be at the same indentation level
|
# see: https://github.com/psf/black/issues/557
|
||||||
with patch("builtins.input", side_effect=_mock_input(text)) as mock_input, \
|
with patch("builtins.input", side_effect=_mock_input(text)) as mock_input, \
|
||||||
patch("getpass.getpass", side_effect=_mock_getpass(text)) as mock_getpass, \
|
patch("getpass.getpass", side_effect=_mock_getpass(text)) as mock_getpass, \
|
||||||
patch("sys.stdin.read", side_effect=text) as mock_read:
|
patch("sys.stdin.read", side_effect=text) as mock_read:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cli.run(args or [])
|
cli.run(args or [])
|
||||||
context.exit_status = 0
|
context.exit_status = 0
|
||||||
|
|
|
@ -231,8 +231,7 @@ class Journal:
|
||||||
result = [
|
result = [
|
||||||
entry
|
entry
|
||||||
for entry in self.entries
|
for entry in self.entries
|
||||||
if (
|
if (not tags or tagged(entry.tags))
|
||||||
(not tags or tagged(entry.tags))
|
|
||||||
and (not starred or entry.starred)
|
and (not starred or entry.starred)
|
||||||
and (not start_date or entry.date >= start_date)
|
and (not start_date or entry.date >= start_date)
|
||||||
and (not end_date or entry.date <= end_date)
|
and (not end_date or entry.date <= end_date)
|
||||||
|
@ -244,7 +243,6 @@ class Journal:
|
||||||
or contains_lower in entry.body.casefold()
|
or contains_lower in entry.body.casefold()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
self.entries = result
|
self.entries = result
|
||||||
|
|
Loading…
Add table
Reference in a new issue