From d99f78584d0de120ee989f405416e8836424eefc Mon Sep 17 00:00:00 2001 From: Michael Yan Date: Tue, 2 Jul 2024 00:00:36 +0800 Subject: [PATCH] Add flags `stacktrace` and `output` to `create-app` command --- .../cli/profile/commands/CreateAppCommand.groovy | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/grace-shell/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy b/grace-shell/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy index 25a57bddcc..464356ff32 100644 --- a/grace-shell/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy +++ b/grace-shell/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy @@ -50,6 +50,9 @@ import org.grails.cli.profile.repository.MavenProfileRepository import org.grails.io.support.FileSystemResource import org.grails.io.support.Resource +import static org.grails.build.parsing.CommandLine.STACKTRACE_ARGUMENT +import static org.grails.build.parsing.CommandLine.VERBOSE_ARGUMENT + /** * Command for creating Grails applications * @@ -86,6 +89,8 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos description.flag(name: INPLACE_FLAG, description: 'Used to create an application using the current directory') description.flag(name: PROFILE_FLAG, description: 'The profile to use', required: false) description.flag(name: FEATURES_FLAG, description: 'The features to use', required: false) + description.flag(name: STACKTRACE_ARGUMENT, description: 'Show full stacktrace', required: false) + description.flag(name: VERBOSE_ARGUMENT, description: 'Show verbose output', required: false) } protected void populateDescription() { @@ -362,7 +367,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos String profileName = evaluateProfileName(commandLine) - List validFlags = [INPLACE_FLAG, PROFILE_FLAG, FEATURES_FLAG] + List validFlags = [INPLACE_FLAG, PROFILE_FLAG, FEATURES_FLAG, STACKTRACE_ARGUMENT, VERBOSE_ARGUMENT] commandLine.undeclaredOptions.each { String key, Object value -> if (!validFlags.contains(key)) { List possibleSolutions = validFlags.findAll { it.substring(0, 2) == key.substring(0, 2) } @@ -387,6 +392,8 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos grailsVersion: Environment.getPackage().getImplementationVersion() ?: GRAILS_VERSION_FALLBACK_IN_IDE_ENVIRONMENTS_FOR_RUNNING_TESTS, features: features, inplace: inPlace, + stacktrace: commandLine.hasOption(STACKTRACE_ARGUMENT), + verbose: commandLine.hasOption(VERBOSE_ARGUMENT), console: executionContext.console ) @@ -802,6 +809,8 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos String grailsVersion List features boolean inplace = false + boolean stacktrace = false + boolean verbose = false GrailsConsole console }