mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-29 22:16:13 +02:00
Introduce legacy classes
This commit is contained in:
parent
df82ad1f4d
commit
a5f08e6081
6 changed files with 77 additions and 52 deletions
14
jrnl/cli.py
14
jrnl/cli.py
|
@ -18,7 +18,7 @@ import argparse
|
|||
import sys
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log = logging.getLogger("jrnl")
|
||||
|
||||
|
||||
def parse_args(args=None):
|
||||
|
@ -147,7 +147,6 @@ def run(manual_args=None):
|
|||
sys.exit(0)
|
||||
|
||||
config = install.load_or_install_jrnl()
|
||||
|
||||
if args.ls:
|
||||
util.prnt(u"Journals defined in {}".format(install.CONFIG_FILE_PATH))
|
||||
ml = min(max(len(k) for k in config['journals']), 20)
|
||||
|
@ -163,6 +162,7 @@ def run(manual_args=None):
|
|||
journal_name = args.text[0] if (args.text and args.text[0] in config['journals']) else 'default'
|
||||
if journal_name is not 'default':
|
||||
args.text = args.text[1:]
|
||||
|
||||
# If the first remaining argument looks like e.g. '-3', interpret that as a limiter
|
||||
if not args.limit and args.text and args.text[0].startswith("-"):
|
||||
try:
|
||||
|
@ -172,16 +172,7 @@ def run(manual_args=None):
|
|||
pass
|
||||
|
||||
log.debug('Using journal "%s"', journal_name)
|
||||
journal_conf = config['journals'].get(journal_name)
|
||||
if type(journal_conf) is dict: # We can override the default config on a by-journal basis
|
||||
log.debug('Updating configuration with specific jourlnal overrides %s', journal_conf)
|
||||
config.update(journal_conf)
|
||||
else: # But also just give them a string to point to the journal file
|
||||
config['journal'] = journal_conf
|
||||
config['journal'] = os.path.expanduser(os.path.expandvars(config['journal']))
|
||||
touch_journal(config['journal'])
|
||||
mode_compose, mode_export, mode_import = guess_mode(args, config)
|
||||
log.debug('Using journal path %(journal)s', config)
|
||||
|
||||
# How to quit writing?
|
||||
if "win32" in sys.platform:
|
||||
|
@ -206,6 +197,7 @@ def run(manual_args=None):
|
|||
else:
|
||||
mode_compose = False
|
||||
|
||||
# This is where we finally open the journal!
|
||||
journal = Journal.open_journal(journal_name, config)
|
||||
|
||||
# Import mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue