Skip to content

Commit

Permalink
Add flags stacktrace and output to create-app command
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Jul 1, 2024
1 parent 086e786 commit d99f785
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -362,7 +367,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos

String profileName = evaluateProfileName(commandLine)

List<String> validFlags = [INPLACE_FLAG, PROFILE_FLAG, FEATURES_FLAG]
List<String> 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) }
Expand All @@ -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
)

Expand Down Expand Up @@ -802,6 +809,8 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
String grailsVersion
List<String> features
boolean inplace = false
boolean stacktrace = false
boolean verbose = false
GrailsConsole console

}
Expand Down

0 comments on commit d99f785

Please sign in to comment.