How to use the jrnl.install.CONFIG_FILE_PATH function in jrnl

To help you get started, we’ve selected a few jrnl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jrnl-org / jrnl / features / steps / core.py View on Github external
def config_var(context, key, value, journal=None):
    t, value = value.split(":")
    value = {"bool": lambda v: v.lower() == "true", "int": int, "str": str}[t](value)
    config = util.load_config(install.CONFIG_FILE_PATH)
    if journal:
        config = config["journals"][journal]
    assert key in config
    assert config[key] == value
github jrnl-org / jrnl / features / steps / core.py View on Github external
def read_journal(journal_name="default"):
    config = util.load_config(install.CONFIG_FILE_PATH)
    with open(config["journals"][journal_name]) as journal_file:
        journal = journal_file.read()
    return journal
github jrnl-org / jrnl / features / steps / core.py View on Github external
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__))
github jrnl-org / jrnl / jrnl / cli.py View on Github external
def list_journals(config):
    """List the journals specified in the configuration file"""
    result = f"Journals defined in {install.CONFIG_FILE_PATH}\n"
    ml = min(max(len(k) for k in config['journals']), 20)
    for journal, cfg in config['journals'].items():
        result += " * {:{}} -> {}\n".format(journal, ml, cfg['journal'] if isinstance(cfg, dict) else cfg)
    return result