Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(manual_args=None):
args = parse_args(manual_args)
configure_logger(args.debug)
if args.version:
version_str = f"{jrnl.__title__} version {jrnl.__version__}"
print(version_str)
sys.exit(0)
try:
config = install.load_or_install_jrnl()
except UserAbort as err:
print(f"\n{err}", file=sys.stderr)
sys.exit(1)
if args.ls:
print(list_journals(config))
sys.exit(0)
log.debug('Using configuration "%s"', config)
original_config = config.copy()
"""Welcome to jrnl {}.
It looks like you've been using an older version of jrnl until now. That's
okay - jrnl will now upgrade your configuration and journal files. Afterwards
you can enjoy all of the great new features that come with jrnl 2:
- Support for storing your journal in multiple files
- Faster reading and writing for large journals
- New encryption back-end that makes installing jrnl much easier
- Tons of bug fixes
Please note that jrnl 1.x is NOT forward compatible with this version of jrnl.
If you choose to proceed, you will not be able to use your journals with
older versions of jrnl anymore.
""".format(
__version__
)
)
encrypted_journals = {}
plain_journals = {}
other_journals = {}
all_journals = []
for journal_name, journal_conf in config["journals"].items():
if isinstance(journal_conf, dict):
path = journal_conf.get("journal")
encrypt = journal_conf.get("encrypt")
else:
encrypt = config.get("encrypt")
path = journal_conf
path = os.path.expanduser(path)
def set_config(context, config_file):
full_path = os.path.join("features/configs", config_file)
install.CONFIG_FILE_PATH = os.path.abspath(full_path)
if config_file.endswith("yaml"):
# Add jrnl version to file for 2.x journals
with open(install.CONFIG_FILE_PATH, "a") as cf:
cf.write("version: {}".format(__version__))
def save_config(config):
config["version"] = __version__
with open(CONFIG_FILE_PATH, "w") as f:
yaml.safe_dump(
config, f, encoding="utf-8", allow_unicode=True, default_flow_style=False
)
encrypt = config.get("encrypt")
path = journal_conf
path = os.path.expanduser(path)
if encrypt:
encrypted_journals[journal_name] = path
elif os.path.isdir(path):
other_journals[journal_name] = path
else:
plain_journals[journal_name] = path
longest_journal_name = max([len(journal) for journal in config["journals"]])
if encrypted_journals:
print(
f"\nFollowing encrypted journals will be upgraded to jrnl {__version__}:",
file=sys.stderr,
)
for journal, path in encrypted_journals.items():
print(
" {:{pad}} -> {}".format(journal, path, pad=longest_journal_name),
file=sys.stderr,
)
if plain_journals:
print(
f"\nFollowing plain text journals will upgraded to jrnl {__version__}:",
file=sys.stderr,
)
for journal, path in plain_journals.items():
print(
" {:{pad}} -> {}".format(journal, path, pad=longest_journal_name),
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'jrnl'
copyright = u'jrnl is made with love by <a href="http://www.1450.me">Manuel Ebert</a> and <a title="Contributors" href="https://github.com/maebert/jrnl/graphs/contributors">other fabulous people</a>. If you need help, tweet to <a title="Follow @maebert on twitter" href="https://twitter.com/maebert">@maebert</a> or <a title="Open a new issue on Github" href="https://github.com/maebert/jrnl/issues/new">submit an issue</a> on Github.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = __version__
# The full version, including alpha/beta/rc tags.
release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']