Example #1
0
def main(args):
    config = get_config()
    
    if args.show:
        print 'Site Config:', SITE_CONFIG
        print get_config(user=False)
        print 'User Config:', USER_CONFIG
        print get_config(site=False)
    
    if args.get:
        print config[args.get]
        return
    
    if args.files:
        print 'User Config:', USER_CONFIG 
        print 'Site Config:', SITE_CONFIG
    
    config = get_config(args.user, not args.user)
    
    for key, value in args.set:
        config[key] = args.type(value)
    
    for key in args.remove:
        if key in config:
            del config[key]
    
    set_config(config, args.user)
Example #2
0
def main(args):
    config = get_config()

    if args.show:
        fmt = ' + %s: %r'
        log.info('Site Config: %s' % SITE_CONFIG)
        for key_value in get_config(user=False).items():
            log.info(fmt % key_value)
        log.info("")
        log.info('User Config: %s' % USER_CONFIG)
        for key_value in get_config(site=False).items():
            log.info(fmt % key_value)
        log.info("")
        return

    if args.get:
        if args.get in config:
            log.info(config[args.get])
        else:
            log.info("The value of '%s' is not set." % args.get)
        return

    if args.files:
        log.info('User Config: %s' % USER_CONFIG)
        log.info('Site Config: %s' % SITE_CONFIG)
        return

    config = get_config(args.user, not args.user)

    for key, value in args.set:
        recursive_set(config, key, value, args.type)
        config[key] = args.type(value)

    for key in args.remove:
        try:
            recursive_remove(config, key)
        except KeyError:
            log.error("Key %s does not exist" % key)

    if not (args.set or args.remove):
        raise ShowHelp()

    set_config(config, args.user)
def main(args):
    config = get_config()

    if args.show:
        fmt = " + %s: %r"
        log.info("Site Config: %s" % SITE_CONFIG)
        for key_value in get_config(user=False).items():
            log.info(fmt % key_value)
        log.info("")
        log.info("User Config: %s" % USER_CONFIG)
        for key_value in get_config(site=False).items():
            log.info(fmt % key_value)
        log.info("")
        return

    if args.get:
        if args.get in config:
            log.info(config[args.get])
        else:
            log.info("The value of '%s' is not set." % args.get)
        return

    if args.files:
        log.info("User Config: %s" % USER_CONFIG)
        log.info("Site Config: %s" % SITE_CONFIG)
        return

    config = get_config(args.user, not args.user)

    for key, value in args.set:
        recursive_set(config, key, value, args.type)
        config[key] = args.type(value)

    for key in args.remove:
        try:
            recursive_remove(config, key)
        except KeyError:
            log.error("Key %s does not exist" % key)

    if not (args.set or args.remove):
        raise ShowHelp()

    set_config(config, args.user)
Example #4
0
def main(args):
    config = get_config()

    if args.show:
        fmt = ' + %s: %r'
        log.info('Site Config: %s' % SITE_CONFIG)
        for key_value in get_config(user=False).items():
            log.info(fmt % key_value)
        log.info("")
        log.info('User Config: %s' % USER_CONFIG)
        for key_value in get_config(site=False).items():
            log.info(fmt % key_value)
        log.info("")
        return

    if args.get:
        log.info(config[args.get])
        return

    if args.files:
        log.info('User Config: %s' % USER_CONFIG)
        log.info('Site Config: %s' % SITE_CONFIG)
        return

    config = get_config(args.user, not args.user)

    for key, value in args.set:
        config[key] = args.type(value)

    for key in args.remove:
        if key in config:
            del config[key]

    if not (args.set or args.remove):
        raise ShowHelp()

    set_config(config, args.user)
Example #5
0
def main(args):
    config = get_config()

    if args.show:
        fmt = " + %s: %r"
        log.info("Site Config: %s" % SITE_CONFIG)
        for key_value in get_config(user=False).items():
            log.info(fmt % key_value)
        log.info("")
        log.info("User Config: %s" % USER_CONFIG)
        for key_value in get_config(site=False).items():
            log.info(fmt % key_value)
        log.info("")
        return

    if args.get:
        log.info(config[args.get])
        return

    if args.files:
        log.info("User Config: %s" % USER_CONFIG)
        log.info("Site Config: %s" % SITE_CONFIG)
        return

    config = get_config(args.user, not args.user)

    for key, value in args.set:
        config[key] = args.type(value)

    for key in args.remove:
        if key in config:
            del config[key]

    if not (args.set or args.remove):
        raise ShowHelp()

    set_config(config, args.user)
Example #6
0
def main(args):
    config = get_config()
    
    if args.show:
        fmt = ' + %s: %r'
        print 'Site Config:', SITE_CONFIG
        for key_value in get_config(user=False).items():
            print fmt % key_value
        print
        print 'User Config:', USER_CONFIG
        for key_value in get_config(site=False).items():
            print fmt % key_value
        print
        return
    
    if args.get:
        print config[args.get]
        return
    
    if args.files:
        print 'User Config:', USER_CONFIG 
        print 'Site Config:', SITE_CONFIG
    
    config = get_config(args.user, not args.user)
    
    for key, value in args.set:
        config[key] = args.type(value)
    
    for key in args.remove:
        if key in config:
            del config[key]
            
    if not (args.set or args.remove):
        raise ShowHelp()
    
    set_config(config, args.user)
Example #7
0
 def set_api_url(url):
     """Set the anaconda client url configuration."""
     data = get_config()
     data['url'] = url
     set_config(data)