@@ -53,6 +53,7 @@ import org.grails.build.logging.GrailsConsoleAntProject
5353import org.grails.build.logging.GrailsConsoleLogger
5454import org.grails.build.parsing.CommandLine
5555import org.grails.cli.GrailsCli
56+ import org.grails.cli.profile.CommandArgument
5657import org.grails.cli.profile.CommandDescription
5758import org.grails.cli.profile.ExecutionContext
5859import org.grails.cli.profile.Feature
@@ -221,15 +222,17 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
221222
222223 String profileName = commandLine. optionValue(' profile' )?. toString() ?: getDefaultProfile()
223224
224- List<String > validFlags = [INPLACE_FLAG , PACKAGE_NAME_FLAG , ' p ' , PROFILE_FLAG , FEATURES_FLAG , TEMPLATE_FLAG , ' m ' ,
225- CSS_FLAG , ' c ' , JAVASCRIPT_FLAG , ' j ' , DATABASE_FLAG , ' d ' ,
225+ List<String > validFlags = [INPLACE_FLAG , PACKAGE_NAME_FLAG , PROFILE_FLAG , FEATURES_FLAG , TEMPLATE_FLAG ,
226+ CSS_FLAG , JAVASCRIPT_FLAG , DATABASE_FLAG ,
226227 STACKTRACE_ARGUMENT , VERBOSE_ARGUMENT , QUIET_ARGUMENT ,
227228 GRACE_VERSION_FLAG , BOOT_VERSION_FLAG , MINIMAL_FLAG , FORCE_FLAG ]
229+
228230 if (! commandLine. hasOption(ENABLE_PREVIEW_FLAG )) {
231+ List<String > validAliases = this . description. flags. collect {it. aliases }
229232 commandLine. undeclaredOptions. each { String key , Object value ->
230- if (! validFlags. contains(key)) {
233+ if (! key . startsWith( ' skip- ' ) && ! validAliases . contains(key) && ! validFlags. contains(key)) {
231234 List possibleSolutions = validFlags. findAll { String flag ->
232- flag. substring(0 , 2 ) == ( key. length() > 1 ? key . substring(0 , 2 ) : key . substring( 0 , 1 ) )
235+ flag. substring(0 , 2 ) == key. substring(0 , 2 )
233236 }
234237 StringBuilder warning = new StringBuilder (" Unrecognized flag: ${ key} ." )
235238 if (possibleSolutions) {
@@ -241,6 +244,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
241244 }
242245 }
243246
247+ Map<String , String > args = getCommandArguments(commandLine)
244248 String grailsVersion = GrailsVersion . current(). version
245249 String specificGraceVersion = commandLine. optionValue(GRACE_VERSION_FLAG )
246250 String specificBootVersion = commandLine. optionValue(BOOT_VERSION_FLAG )
@@ -250,7 +254,12 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
250254 List<String > features = commandLine. hasOption(' features' ) ?
251255 ((commandLine. optionValue(' features' ) && ! (commandLine. optionValue(' features' ) instanceof Boolean )) ?
252256 commandLine. optionValue(' features' ). toString()?. split(' ,' )?. toList() : []) : null
253- Map<String , String > args = getCommandArguments(commandLine)
257+
258+ List<String > skippedFeatures = commandLine. undeclaredOptions. collect { String key , Object value ->
259+ if (key. startsWith(' skip-' )) {
260+ key. substring(5 )
261+ }
262+ }
254263
255264 CreateAppCommandObject cmd = new CreateAppCommandObject (
256265 appName : appName,
@@ -260,6 +269,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
260269 grailsVersion : specificGraceVersion ?: grailsVersion,
261270 springBootVersion : specificBootVersion,
262271 features : features,
272+ skippedFeatures : skippedFeatures,
263273 database : commandLine. optionValue(DATABASE_FLAG ) ?: (commandLine. optionValue(' d' ) ?: ' h2' ),
264274 template : commandLine. optionValue(' template' ) ?: commandLine. optionValue(' m' ),
265275 inplace : inPlace,
@@ -366,7 +376,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
366376 }
367377 }
368378
369- List<Feature > features = cmd. minimal ? [] : evaluateFeatures(profileInstance, cmd. features, cmd. console)
379+ List<Feature > features = cmd. minimal ? [] : evaluateFeatures(profileInstance, cmd. features, cmd. skippedFeatures, cmd . console)
370380
371381 Map<String , String > variables = initializeVariables(appName, groupName, defaultPackageName, profileName, features, cmd. template, cmd. grailsVersion)
372382 Map<String , String > args = new HashMap<> ()
@@ -480,7 +490,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
480490 true
481491 }
482492
483- protected List<Feature > evaluateFeatures (Profile profile , List<String > requestedFeatures , GrailsConsole console ) {
493+ protected List<Feature > evaluateFeatures (Profile profile , List<String > requestedFeatures , List< String > skippedFeatures , GrailsConsole console ) {
484494 List<Feature > features
485495 if (requestedFeatures != null && requestedFeatures. size() > 0 ) {
486496 List<String > allFeatureNames = profile. features* . name
@@ -505,7 +515,9 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
505515 else {
506516 features = (profile. defaultFeatures + profile. requiredFeatures). toList(). unique()
507517 }
508- features?. sort {
518+ features. findAll {
519+ ! skippedFeatures. contains(it. name)
520+ }. sort {
509521 it. name
510522 }
511523 }
@@ -1559,6 +1571,7 @@ group """
15591571 String grailsVersion
15601572 String springBootVersion
15611573 List<String > features
1574+ List<String > skippedFeatures
15621575 String database
15631576 String template
15641577 boolean minimal = false
0 commit comments