class GlacierUploader {

    public static void main(String[] args) {
        // Get our options
        final GlacierUploaderOptionParser optionParser = new GlacierUploaderOptionParser(setupConfig());
        final OptionSet options;

        // Parse them
        try {
            options = optionParser.parse(args);
        } catch (Exception e) {
            LOG.error("Something went wrong parsing the arguments", e);
            return;
        }

        String region = options.valueOf(optionParser.region);
        // check deprecated, but supported config parameters
        if(StringUtils.isBlank(region) && options.has(optionParser.endpoint)) {
            LOG.warn("Option {} is deprecated, please switch to {}", optionParser.endpoint, optionParser.region);
            String endpointUrl = options.valueOf(optionParser.endpoint);
            region = optionParser.parseEndpointToRegion(endpointUrl);
            LOG.debug("Parsed {} from configured endpoint", region , endpointUrl);
        }

        // check deprecated config parameters
        final List<? extends OptionSpec<? extends Serializable>> specs = Arrays.asList(optionParser.credentials);
        for(OptionSpec spec : specs) {
            if (options.has(spec)) {
                LOG.info("Option {} is deprecated, will be ignored", specs);
            }
        }

        // last sanity check
        if(region == null) {
            LOG.error("Region is not configured.");
        }

        // Launch
        findAndExecCommand(region, options, optionParser);
    }

    private  GlacierUploader();

}