public static void main(String[] args) throws IOException, ZipException {
if (args.length == 2) {
Updater updater = new Updater();
GHRelease latestVersion = updater.getLatestVersion();
logger.info("Updating homedash to version:" + latestVersion.getName());
String downloadPath = args[INDEX_DOWNLOAD_PATH];
String installPath = args[INDEX_INSTALL_PATH];
try {
updater.doUpdate(downloadPath, installPath);
System.exit(0);
} catch (FileNotFoundException e) {
logger.info("One or both the path given don't exist");
logger.info("Download Path:" + downloadPath);
logger.info("Install Path:" + installPath);
System.exit(ERROR_WRONG_PATHS_GIVEN);
} catch (WrongInstallPathStructure wrongInstallPathStructure) {
logger.info("The install path structure doesn't match what is expected");
System.exit(ERROR_INSTALL_PATH_WRONG_STRUCTURE);
}
} else {
logger.info("Missing arguments, arguments given:" + Stream.of(args).collect(Collectors.joining("],[", "[", "]")));
logger.info("Expected: [downloadPath], [installPath]");
System.exit(ERROR_ARGUMENTS);
}
}