mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-18 03:58:32 +02:00
Bug fixes.
This commit is contained in:
parent
e36c152a0a
commit
ef9444f78a
2 changed files with 10 additions and 9 deletions
|
@ -16,6 +16,7 @@ from . import plugins
|
||||||
from .util import WARNING_COLOR, ERROR_COLOR, RESET_COLOR
|
from .util import WARNING_COLOR, ERROR_COLOR, RESET_COLOR
|
||||||
import jrnl
|
import jrnl
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -160,9 +161,9 @@ def run(manual_args=None):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# create a config entry for the new journal
|
# create a config entry for the new journal
|
||||||
journal_file_path = os.path.join(os.path.expanduser('.'),
|
default_file_path = os.path.join(os.path.abspath('.'),
|
||||||
install.DEFAULT_JOURNAL_NAME)
|
install.DEFAULT_JOURNAL_NAME)
|
||||||
config = install.create(journal_name, journal_file_path, config)
|
config = install.create(journal_name, default_file_path, config)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# If the first textual argument points to a journal file,
|
# If the first textual argument points to a journal file,
|
||||||
|
|
|
@ -91,7 +91,7 @@ def load_or_install_jrnl():
|
||||||
log.debug('Configuration file not found, installing jrnl...')
|
log.debug('Configuration file not found, installing jrnl...')
|
||||||
return install()
|
return install()
|
||||||
|
|
||||||
def create(journal_name, default_journal_file_path=None, config=None):
|
def create(journal_name, default_file_path=None, config=None):
|
||||||
def autocomplete(text, state):
|
def autocomplete(text, state):
|
||||||
expansions = glob.glob(os.path.expanduser(os.path.expandvars(text)) + '*')
|
expansions = glob.glob(os.path.expanduser(os.path.expandvars(text)) + '*')
|
||||||
expansions = [e + "/" if os.path.isdir(e) else e for e in expansions]
|
expansions = [e + "/" if os.path.isdir(e) else e for e in expansions]
|
||||||
|
@ -106,13 +106,12 @@ def create(journal_name, default_journal_file_path=None, config=None):
|
||||||
config = default_config
|
config = default_config
|
||||||
|
|
||||||
# Set up the default journal file path
|
# Set up the default journal file path
|
||||||
if default_journal_file_path is None:
|
if default_file_path is None:
|
||||||
default_journal_file_path = JOURNAL_FILE_PATH
|
default_file_path = JOURNAL_FILE_PATH
|
||||||
|
|
||||||
# Where to create the journal?
|
# Where to create the journal?
|
||||||
path_query = 'Path to your journal file (leave blank for {}): '.format(default_journal_file_path)
|
path_query = 'Path to your journal file (leave blank for {}): '.format(default_file_path)
|
||||||
journal_path = util.py23_input(path_query).strip() or \
|
journal_path = util.py23_input(path_query).strip() or default_file_path
|
||||||
default_journal_file_path
|
|
||||||
journal_path = os.path.expanduser(os.path.expandvars(journal_path))
|
journal_path = os.path.expanduser(os.path.expandvars(journal_path))
|
||||||
config['journals'][journal_name] = {'journal': journal_path}
|
config['journals'][journal_name] = {'journal': journal_path}
|
||||||
|
|
||||||
|
@ -129,7 +128,6 @@ def create(journal_name, default_journal_file_path=None, config=None):
|
||||||
# Encrypt it?
|
# Encrypt it?
|
||||||
password = getpass.getpass("Enter password for journal (leave blank for no encryption): ")
|
password = getpass.getpass("Enter password for journal (leave blank for no encryption): ")
|
||||||
if password:
|
if password:
|
||||||
config['journals'][journal_name]['password'] = password
|
|
||||||
config['journals'][journal_name]['encrypt'] = True
|
config['journals'][journal_name]['encrypt'] = True
|
||||||
if util.yesno("Do you want to store the password in your keychain?", default=True):
|
if util.yesno("Do you want to store the password in your keychain?", default=True):
|
||||||
util.set_keychain(journal_name, password)
|
util.set_keychain(journal_name, password)
|
||||||
|
@ -141,6 +139,8 @@ def create(journal_name, default_journal_file_path=None, config=None):
|
||||||
PlainJournal._create(journal_path)
|
PlainJournal._create(journal_path)
|
||||||
|
|
||||||
save_config(config)
|
save_config(config)
|
||||||
|
if password:
|
||||||
|
config['password'] = password
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def install():
|
def install():
|
||||||
|
|
Loading…
Add table
Reference in a new issue