示例#1
0
 def add(name):
     """
     Usage:
         parguments add <name>
     """
     print(prompt_bool(name='correct', default=True, yes_choices=['y'],
                       no_choices=['n']) and 'yes' or 'no')
示例#2
0
文件: config.py 项目: Yougeme/catsup
def parse(path):
    """
    Parser json configuration file
    """
    try:
        f = open(path, 'r')
    except IOError:
        print("Can't find config file %s" % path)

        if prompt_bool("Create a new config file", default=True):
            create_config_file()
        else:
            logger.error("Can't find config file. Exiting..")
        sys.exit(0)
    return update_nested_dict(ObjectDict(), ujson.load(f))
示例#3
0
def parse(path):
    """
    Parser json configuration file
    """
    try:
        f = open(path, "r")
    except IOError:
        print("Can't find config file %s" % path)

        if prompt_bool("Create a new config file", default=True):
            init("")
        else:
            import logging

            logging.error("Can't find config file." "Exiting catsup.")
            sys.exit(0)
    else:
        update_config(config, json_decode(f.read()))