Example #1
0
def set_config(args):
    """
    set config option
    Arguments:
    - `args`: list of arguments, 0 is always command name
    """
    l = logging.getLogger("screpper.cli")
    l.info("set config")

    cmd = args[0]

    name, path = __extract_repo_name_path(args)

    repo = open_repo(path)
    # skip args 0 and 1
    if len(args) < 3:
        raise InvalidParameters("not enough arguments", cmd)

    args = args[2:]
    # the format of key value key value..
    # even number of arguments is needed
    if not args or len(args) % 2 != 0:
        raise InvalidParameters("incorrect arguments format", cmd)

    # pack everythong into a dict
    setc = dict(zip(args[0::2], args[1::2]))

    repo.set_config(setc)
Example #2
0
def gc_repo(args):
    """run gc in repository
    
    Arguments:
    - `args`: list of arguments, 0 is always command name
    """
    l = logging.getLogger("screpper.cli")
    l.info("run gc on repository")

    name, path = __extract_repo_name_path(args)

    repo = open_repo(path)
    repo.run_gc()
Example #3
0
def get_config(args):
    """
    get config option
    Arguments:
    - `args`: list of arguments, 0 is always command name
    """
    l = logging.getLogger("screpper.cli")
    l.info("get config")

    name, path = __extract_repo_name_path(args)

    repo = open_repo(path)
    conf = repo.get_config()
    for k, v in conf.iteritems():
        print "%s -> %s" % (k, v)