From 9cc37f964f7cc77e2bc60e136a510d06ac86765d Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Sun, 26 Jan 2014 14:15:46 +0100 Subject: [PATCH] Fix a logic bug so that jrnl -h and jrnl -v are possible even if jrnl not configured yet. --- CHANGELOG.md | 1 + jrnl/__init__.py | 2 +- jrnl/cli.py | 12 +++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae6079b9..48c68473 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog ### 1.7 (December 22, 2013) +* __1.7.9__ Fix a logic bug so that jrnl -h and jrnl -v are possible even if jrnl not configured yet. * __1.7.8__ Upgrade to parsedatetime 1.2 * __1.7.7__ Cleaned up imports, better unicode support * __1.7.6__ Python 3 port for slugify diff --git a/jrnl/__init__.py b/jrnl/__init__.py index f4143c27..8842f8ec 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -8,7 +8,7 @@ jrnl is a simple journal application for your command line. from __future__ import absolute_import __title__ = 'jrnl' -__version__ = '1.7.8' +__version__ = '1.7.9' __author__ = 'Manuel Ebert' __license__ = 'MIT License' __copyright__ = 'Copyright 2013 - 2014 Manuel Ebert' diff --git a/jrnl/cli.py b/jrnl/cli.py index 7a9c1b55..1538352a 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -100,6 +100,13 @@ def update_config(config, new_config, scope, force_local=False): config.update(new_config) def run(manual_args=None): + args = parse_args(manual_args) + + if args.version: + version_str = "{0} version {1}".format(jrnl.__title__, jrnl.__version__) + print(util.py2encode(version_str)) + sys.exit(0) + if not os.path.exists(CONFIG_PATH): config = install.install_jrnl(CONFIG_PATH) else: @@ -112,12 +119,7 @@ def run(manual_args=None): util.prompt("According to your jrnl_conf, your journal is encrypted, however PyCrypto was not found. To open your journal, install the PyCrypto package from http://www.pycrypto.org.") sys.exit(1) - args = parse_args(manual_args) - if args.version: - version_str = "{0} version {1}".format(jrnl.__title__, jrnl.__version__) - print(util.py2encode(version_str)) - sys.exit(0) # If the first textual argument points to a journal file, # use this!