Suppress "Entry added" message if using default journal (#1561)

* Suppress "Entry added to default journal" message if using default journal
* Replace "Entry added" BDD test steps with "we should get no error" now that the message is suppressed
* Add positive and negative tests for "Entry added" message behavior
This commit is contained in:
Micah Jerome Ellison 2022-08-27 12:33:44 -07:00 committed by GitHub
parent bb6491bd06
commit f65f07dbcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 35 deletions

View file

@ -7,6 +7,7 @@ import sys
from jrnl import install
from jrnl import plugins
from jrnl import time
from jrnl.config import DEFAULT_JOURNAL_KEY
from jrnl.config import get_config_path
from jrnl.config import get_journal_name
from jrnl.config import scope_config
@ -146,13 +147,14 @@ def write_mode(args, config, journal, **kwargs):
'Write mode: appending raw text to journal "%s": %s', args.journal_name, raw
)
journal.new_entry(raw)
print_msg(
Message(
MsgText.JournalEntryAdded,
MsgStyle.NORMAL,
{"journal_name": args.journal_name},
if args.journal_name != DEFAULT_JOURNAL_KEY:
print_msg(
Message(
MsgText.JournalEntryAdded,
MsgStyle.NORMAL,
{"journal_name": args.journal_name},
)
)
)
journal.write()
logging.debug("Write mode: completed journal.write()")