def main(args=None):
    """The main routine."""
    # example './cli.py install redis --app-name tambeta'
    parser = get_cli_parser()
    if args is None:
        args = sys.argv[1:]
    args = parser.parse_args(args)

    # set the credential in the environment
    if args.webfaction_user:
        os.environ['WEBFACTION_USER'] = args.webfaction_user
    if args.webfaction_pass:
        os.environ['WEBFACTION_PASS'] = args.webfaction_pass
    if args.webfaction_host:
        os.environ['WEBFACTION_HOST'] = args.webfaction_host

    if args.action == "install":
        if args.name == 'redis':
            if not args.app_name:
                print("Install Redis requires app name")
                sys.exit(1)
        else:
            print("Unknown install %s" % args.name)
    elif args.action == "secure":
        print("Converting websites in the domain %s to HTTPS" % (args.name or '*'))
        w = WebfactionWebsiteToSsl(force=args.force)
        w.secure(domain=args.name)
    elif args.action == "renew":
        domain = args.name
        if not domain:
            print("Renew certificates for all the domains")
        else:
            print("Renew certificates for %s" % domain)
        w = WebfactionWebsiteToSsl(force=args.force)
        w.sync_certificates(subdomains=args.name)