use of com.devonfw.cobigen.cli.exceptions.UserAbortException in project cobigen by devonfw.
the class GenerateCommand method setRootOutputDirectoryWithPrompt.
/**
* Opens a looping prompt with a yes/no question and sets the root output directory to the current user directory.
*/
private void setRootOutputDirectoryWithPrompt() {
Path outputDirectory = Paths.get(System.getProperty("user.dir"));
boolean setToUserDir = ValidationUtils.yesNoPrompt("Set output directory to: " + outputDirectory.toString(), "Invalid input. Please answer yes/n or no/n (or hit return for yes).", "Cancelling generate process... you can use -o to explicitly set the output directory.");
try {
if (setToUserDir) {
this.outputRootPath = outputDirectory;
} else {
throw new UserAbortException();
}
} catch (UserAbortException e) {
LOG.debug("Generation process was cancelled by the user.");
System.exit(255);
}
}
Aggregations