Search in sources :

Example 1 with InputErrorException

use of eu.stamp_project.dspot.common.configuration.check.InputErrorException in project dspot by STAMP-project.

the class Main method parse.

public static UserInput parse(String[] args) {
    UserInput userInput = new UserInput();
    final CommandLine commandLine = new CommandLine(userInput);
    commandLine.setUsageHelpWidth(120);
    try {
        commandLine.parseArgs(args);
    } catch (Exception e) {
        e.printStackTrace();
        commandLine.usage(System.err);
        return null;
    }
    if (commandLine.isUsageHelpRequested()) {
        commandLine.usage(System.out);
        return null;
    }
    if (commandLine.isVersionHelpRequested()) {
        commandLine.printVersionHelp(System.out);
        return null;
    }
    if (userInput.shouldRunExample()) {
        userInput.configureExample();
    }
    try {
        Checker.preChecking(userInput);
    } catch (InputErrorException e) {
        e.printStackTrace();
        commandLine.usage(System.err);
        return null;
    }
    return userInput;
}
Also used : CommandLine(picocli.CommandLine) UserInput(eu.stamp_project.dspot.common.configuration.UserInput) InputErrorException(eu.stamp_project.dspot.common.configuration.check.InputErrorException) InputErrorException(eu.stamp_project.dspot.common.configuration.check.InputErrorException)

Example 2 with InputErrorException

use of eu.stamp_project.dspot.common.configuration.check.InputErrorException in project dspot by STAMP-project.

the class Main method main.

public static void main(String[] args) {
    UserInput inputConfiguration = new UserInput();
    final CommandLine commandLine = new CommandLine(inputConfiguration);
    commandLine.setUsageHelpWidth(120);
    try {
        commandLine.parseArgs(args);
    } catch (Exception e) {
        e.printStackTrace();
        commandLine.usage(System.err);
        return;
    }
    if (commandLine.isUsageHelpRequested()) {
        commandLine.usage(System.out);
        return;
    }
    if (commandLine.isVersionHelpRequested()) {
        commandLine.printVersionHelp(System.out);
        return;
    }
    if (inputConfiguration.shouldRunExample()) {
        inputConfiguration.configureExample();
    }
    try {
        Checker.preChecking(inputConfiguration);
    } catch (InputErrorException e) {
        e.printStackTrace();
        commandLine.usage(System.err);
        return;
    }
    DSpotState.verbose = inputConfiguration.isVerbose();
    run(inputConfiguration);
}
Also used : CommandLine(picocli.CommandLine) UserInput(eu.stamp_project.prettifier.options.UserInput) InputErrorException(eu.stamp_project.dspot.common.configuration.check.InputErrorException) InputErrorException(eu.stamp_project.dspot.common.configuration.check.InputErrorException) IOException(java.io.IOException)

Aggregations

InputErrorException (eu.stamp_project.dspot.common.configuration.check.InputErrorException)2 CommandLine (picocli.CommandLine)2 UserInput (eu.stamp_project.dspot.common.configuration.UserInput)1 UserInput (eu.stamp_project.prettifier.options.UserInput)1 IOException (java.io.IOException)1