Search in sources :

Example 1 with Cli

use of org.opendatakit.common.cli.Cli in project briefcase by opendatakit.

the class Launcher method main.

public static void main(String[] args) {
    BriefcasePreferences appPreferences = BriefcasePreferences.appScoped();
    if (!appPreferences.hasKey(BRIEFCASE_TRACKING_CONSENT_PROPERTY))
        appPreferences.put(BRIEFCASE_TRACKING_CONSENT_PROPERTY, TRUE.toString());
    Optional<SentryClient> sentry = SENTRY_ENABLED ? Optional.of(initSentryClient(appPreferences)) : Optional.empty();
    new Cli().deprecate(DEPRECATED_PULL_AGGREGATE, PULL_AGGREGATE).deprecate(DEPRECATED_PULL_IN_PARALLEL, MAX_HTTP_CONNECTIONS).deprecate(DEPRECATED_AGGREGATE_SERVER, SERVER_URL).register(PULL_FORM_FROM_AGGREGATE).register(PullFormFromCentral.OPERATION).register(PUSH_FORM_TO_AGGREGATE).register(PushFormToCentral.OPERATION).register(IMPORT_FROM_ODK).register(EXPORT_FORM).register(CLEAR_PREFS).otherwise((cli, commandLine) -> {
        if (args.length == 0)
            launchGUI();
        else
            runLegacyCli(commandLine, cli::printHelp);
    }).onError(throwable -> {
        System.err.println(throwable instanceof BriefcaseException ? "Error: " + throwable.getMessage() : "Unexpected error in Briefcase. Please review briefcase.log for more information. For help, post to https://forum.getodk.org/c/support");
        log.error("Error", throwable);
        sentry.ifPresent(client -> client.sendException(throwable));
        System.exit(1);
    }).run(args);
}
Also used : EXPORT_FORM(org.opendatakit.briefcase.operations.Export.EXPORT_FORM) BriefcasePreferences(org.opendatakit.briefcase.model.BriefcasePreferences) LoggerFactory(org.slf4j.LoggerFactory) DEPRECATED_PULL_AGGREGATE(org.opendatakit.briefcase.operations.PullFormFromAggregate.DEPRECATED_PULL_AGGREGATE) PULL_AGGREGATE(org.opendatakit.briefcase.operations.PullFormFromAggregate.PULL_AGGREGATE) BRIEFCASE_TRACKING_CONSENT_PROPERTY(org.opendatakit.briefcase.model.BriefcasePreferences.BRIEFCASE_TRACKING_CONSENT_PROPERTY) PushFormToCentral(org.opendatakit.briefcase.operations.PushFormToCentral) MAX_HTTP_CONNECTIONS(org.opendatakit.briefcase.operations.Common.MAX_HTTP_CONNECTIONS) MainBriefcaseWindow.launchGUI(org.opendatakit.briefcase.ui.MainBriefcaseWindow.launchGUI) BriefcaseException(org.opendatakit.briefcase.reused.BriefcaseException) SERVER_URL(org.opendatakit.briefcase.operations.Common.SERVER_URL) BriefcaseCLI.runLegacyCli(org.opendatakit.briefcase.ui.BriefcaseCLI.runLegacyCli) Sentry(io.sentry.Sentry) CLEAR_PREFS(org.opendatakit.briefcase.operations.ClearPreferences.CLEAR_PREFS) IMPORT_FROM_ODK(org.opendatakit.briefcase.operations.ImportFromODK.IMPORT_FROM_ODK) Logger(org.slf4j.Logger) PullFormFromCentral(org.opendatakit.briefcase.operations.PullFormFromCentral) SentryClient(io.sentry.SentryClient) PUSH_FORM_TO_AGGREGATE(org.opendatakit.briefcase.operations.PushFormToAggregate.PUSH_FORM_TO_AGGREGATE) Host.getOsName(org.opendatakit.briefcase.util.Host.getOsName) VERSION(org.opendatakit.briefcase.buildconfig.BuildConfig.VERSION) Cli(org.opendatakit.common.cli.Cli) SENTRY_DSN(org.opendatakit.briefcase.buildconfig.BuildConfig.SENTRY_DSN) SENTRY_ENABLED(org.opendatakit.briefcase.buildconfig.BuildConfig.SENTRY_ENABLED) DEPRECATED_AGGREGATE_SERVER(org.opendatakit.briefcase.operations.Common.DEPRECATED_AGGREGATE_SERVER) Optional(java.util.Optional) DEPRECATED_PULL_IN_PARALLEL(org.opendatakit.briefcase.operations.PullFormFromAggregate.DEPRECATED_PULL_IN_PARALLEL) TRUE(java.lang.Boolean.TRUE) PULL_FORM_FROM_AGGREGATE(org.opendatakit.briefcase.operations.PullFormFromAggregate.PULL_FORM_FROM_AGGREGATE) BriefcaseCLI.runLegacyCli(org.opendatakit.briefcase.ui.BriefcaseCLI.runLegacyCli) Cli(org.opendatakit.common.cli.Cli) BriefcaseException(org.opendatakit.briefcase.reused.BriefcaseException) BriefcasePreferences(org.opendatakit.briefcase.model.BriefcasePreferences) SentryClient(io.sentry.SentryClient)

Aggregations

Sentry (io.sentry.Sentry)1 SentryClient (io.sentry.SentryClient)1 TRUE (java.lang.Boolean.TRUE)1 Optional (java.util.Optional)1 SENTRY_DSN (org.opendatakit.briefcase.buildconfig.BuildConfig.SENTRY_DSN)1 SENTRY_ENABLED (org.opendatakit.briefcase.buildconfig.BuildConfig.SENTRY_ENABLED)1 VERSION (org.opendatakit.briefcase.buildconfig.BuildConfig.VERSION)1 BriefcasePreferences (org.opendatakit.briefcase.model.BriefcasePreferences)1 BRIEFCASE_TRACKING_CONSENT_PROPERTY (org.opendatakit.briefcase.model.BriefcasePreferences.BRIEFCASE_TRACKING_CONSENT_PROPERTY)1 CLEAR_PREFS (org.opendatakit.briefcase.operations.ClearPreferences.CLEAR_PREFS)1 DEPRECATED_AGGREGATE_SERVER (org.opendatakit.briefcase.operations.Common.DEPRECATED_AGGREGATE_SERVER)1 MAX_HTTP_CONNECTIONS (org.opendatakit.briefcase.operations.Common.MAX_HTTP_CONNECTIONS)1 SERVER_URL (org.opendatakit.briefcase.operations.Common.SERVER_URL)1 EXPORT_FORM (org.opendatakit.briefcase.operations.Export.EXPORT_FORM)1 IMPORT_FROM_ODK (org.opendatakit.briefcase.operations.ImportFromODK.IMPORT_FROM_ODK)1 DEPRECATED_PULL_AGGREGATE (org.opendatakit.briefcase.operations.PullFormFromAggregate.DEPRECATED_PULL_AGGREGATE)1 DEPRECATED_PULL_IN_PARALLEL (org.opendatakit.briefcase.operations.PullFormFromAggregate.DEPRECATED_PULL_IN_PARALLEL)1 PULL_AGGREGATE (org.opendatakit.briefcase.operations.PullFormFromAggregate.PULL_AGGREGATE)1 PULL_FORM_FROM_AGGREGATE (org.opendatakit.briefcase.operations.PullFormFromAggregate.PULL_FORM_FROM_AGGREGATE)1 PullFormFromCentral (org.opendatakit.briefcase.operations.PullFormFromCentral)1