Example #1
0
def load_config():
    opts, args = parse_args()

    config = ConfigParser({'log.level': "DEBUG", 'log.file': None})
    config.read(os.path.expanduser(opts.config))
    config.interactive = opts.interactive
    validate_config(config)

    return config
Example #2
0
def load_config(main_section):
    config = ConfigParser({'log.level': "DEBUG", 'log.file': None})
    path = None
    first_path = BaseDirectory.load_first_config('bugwarrior')
    if first_path is not None:
        path = os.path.join(first_path, 'bugwarriorrc')
    old_path = os.path.expanduser("~/.bugwarriorrc")
    if path is None or not os.path.exists(path):
        if os.path.exists(old_path):
            path = old_path
        else:
            path = os.path.join(BaseDirectory.save_config_path('bugwarrior'), 'bugwarriorrc')
    config.readfp(
        codecs.open(
            path,
            "r",
            "utf-8",
        )
    )
    config.interactive = False  # TODO: make this a command-line option
    validate_config(config, main_section)

    return config