コード例 #1
0
ファイル: test_cli.py プロジェクト: whtsky/parguments
 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
ファイル: config.py プロジェクト: hellove1985/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):
            init("")
        else:
            import logging

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