Beispiel #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
Beispiel #2
0
def load_config():
    opts, args = parse_args()

    config = ConfigParser({'log.level': "DEBUG", 'log.file': None})
    config.readfp(
        codecs.open(
            os.path.expanduser(opts.config),
            "r",
            "utf-8",
        )
    )
    config.interactive = opts.interactive
    validate_config(config)

    return config
Beispiel #3
0
def load_config(main_section, interactive=False):
    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 = interactive
    validate_config(config, main_section)

    return config
Beispiel #4
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