Beispiel #1
0
def main():
    ret = True
    args = docopt(USAGE, version=VERSION)
    conf = Cfg(args['--cfg'])

    opts = conf.get_configs()
    opts['dry'] = args['--dry']
    opts['profile'] = args['--profile']
    opts['safe'] = not args['--force']
    opts['installdiff'] = not args['--nodiff']
    opts['link'] = args['--link']
    opts['quiet'] = not args['--verbose']

    header()

    try:

        if args['list']:
            # list existing profiles
            list_profiles(conf)

        elif args['listfiles']:
            # list files for selected profile
            list_files(opts, conf)

        elif args['install']:
            # install the dotfiles stored in dotdrop
            ret = install(opts, conf)

        elif args['compare']:
            # compare local dotfiles with dotfiles stored in dotdrop
            tmp = utils.get_tmpdir()
            if compare(opts, conf, tmp, args['--files']):
                LOG.raw('\ntemporary files available under %s' % (tmp))
            else:
                os.rmdir(tmp)

        elif args['import']:
            # import dotfile(s)
            importer(opts, conf, args['<paths>'])

    except KeyboardInterrupt:
        LOG.err('interrupted')
        ret = False

    return ret
Beispiel #2
0
    for p in conf.get_profiles():
        LOG.sub(p)
    LOG.log('')


def header():
    LOG.log(BANNER)
    LOG.log("")


if __name__ == '__main__':
    ret = True
    args = docopt(USAGE, version=VERSION)
    conf = Cfg(args['--cfg'])

    opts = conf.get_configs()
    opts['dry'] = args['--dry']
    opts['profile'] = args['--profile']
    opts['safe'] = not args['--force']
    opts['installdiff'] = not args['--nodiff']
    opts['link'] = args['--link']

    header()

    try:

        if args['list']:
            list_profiles(conf)

        elif args['install']:
            ret = install(opts, conf)