Feedback on which journal was used

This commit is contained in:
Manuel Ebert 2012-07-05 12:27:57 +02:00
parent 80bb29bf0e
commit 3cbef42e2b

View file

@ -85,7 +85,7 @@ def get_text_from_editor(config):
raw = f.read() raw = f.read()
os.remove(tmpfile) os.remove(tmpfile)
else: else:
print('nothing saved to file') print('[Nothing saved to file]')
raw = '' raw = ''
return raw return raw
@ -133,7 +133,7 @@ def print_tags(journal):
def touch_journal(filename): def touch_journal(filename):
"""If filename does not exist, touch the file""" """If filename does not exist, touch the file"""
if not os.path.exists(filename): if not os.path.exists(filename):
print("[Journal created at {}".format(filename)) print("[Journal created at {}]".format(filename))
open(filename, 'a').close() open(filename, 'a').close()
@ -154,11 +154,10 @@ def cli():
# If the first textual argument points to a journal file, # If the first textual argument points to a journal file,
# use this! # use this!
if args.text and args.text[0] in config['journals']: journal_name = args.text[0] if (args.text and args.text[0] in config['journals']) else 'default'
config['journal'] = config['journals'].get(args.text[0]) if journal_name is not 'default':
args.text = args.text[1:] args.text = args.text[1:]
else: config['journal'] = config['journals'].get(journal_name)
config['journal'] = config['journals'].get('default')
touch_journal(config['journal']) touch_journal(config['journal'])
mode_compose, mode_export = guess_mode(args, config) mode_compose, mode_export = guess_mode(args, config)
@ -170,7 +169,7 @@ def cli():
if config['editor']: if config['editor']:
raw = get_text_from_editor(config) raw = get_text_from_editor(config)
else: else:
raw = raw_input("Compose Entry: ") raw = raw_input("[Compose Entry] ")
if raw: if raw:
args.text = [raw] args.text = [raw]
else: else:
@ -180,7 +179,7 @@ def cli():
if mode_compose: if mode_compose:
raw = " ".join(args.text).strip() raw = " ".join(args.text).strip()
journal.new_entry(raw, args.date) journal.new_entry(raw, args.date)
print("Entry added.") print("[Entry added to {} journal]").format(journal_name)
journal.write() journal.write()
# Reading mode # Reading mode