Search in sources :

Example 1 with CompareMode

use of com.github.checkstyle.data.CompareMode in project contribution by checkstyle.

the class Main method parseCliToPojo.

/**
 * Forms POJO containing input paths.
 *
 * @param commandLine
 *        parsed CLI.
 * @return POJO instance.
 * @throws IllegalArgumentException
 *         on failure to find necessary arguments.
 */
private static CliPaths parseCliToPojo(CommandLine commandLine) throws IllegalArgumentException {
    final CompareMode compareMode = getCompareMode(OPTION_COMPARE_MODE, commandLine, CompareMode.XML);
    final Path xmlBasePath = getPath(OPTION_BASE_REPORT_PATH, commandLine, null);
    final Path xmlPatchPath = getPath(OPTION_PATCH_REPORT_PATH, commandLine, null);
    final Path refFilesPath = getPath(OPTION_REFFILES_PATH, commandLine, null);
    final Path defaultResultPath = Paths.get(System.getProperty("user.home")).resolve("XMLDiffGen_report_" + new SimpleDateFormat("yyyy.MM.dd_HH_mm_ss").format(Calendar.getInstance().getTime()));
    final Path outputPath = getPath(OPTION_OUTPUT_PATH, commandLine, defaultResultPath);
    final Path configBasePath = getPath(OPTION_BASE_CONFIG_PATH, commandLine, null);
    final Path configPatchPath = getPath(OPTION_PATCH_CONFIG_PATH, commandLine, null);
    final boolean shortFilePaths = commandLine.hasOption(OPTION_SHORT_PATHS);
    return new CliPaths(compareMode, xmlBasePath, xmlPatchPath, refFilesPath, outputPath, configBasePath, configPatchPath, shortFilePaths);
}
Also used : Path(java.nio.file.Path) CompareMode(com.github.checkstyle.data.CompareMode) SimpleDateFormat(java.text.SimpleDateFormat) CliPaths(com.github.checkstyle.data.CliPaths)

Aggregations

CliPaths (com.github.checkstyle.data.CliPaths)1 CompareMode (com.github.checkstyle.data.CompareMode)1 Path (java.nio.file.Path)1 SimpleDateFormat (java.text.SimpleDateFormat)1