Skip to content

Commit e109208

Browse files
committed
Allows to create a project that don't include any features
Closes gh-770
1 parent 61f5a76 commit e109208

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

grace-shell/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
226226
boolean inPlace = commandLine.hasOption('inplace') || GrailsCli.isInteractiveModeActive()
227227
String appName = commandLine.remainingArgs ? commandLine.remainingArgs[0] : ''
228228

229-
List<String> features = commandLine.optionValue('features')?.toString()?.split(',')?.toList()
229+
List<String> features = commandLine.hasOption('features') ?
230+
((commandLine.optionValue('features') && !(commandLine.optionValue('features') instanceof Boolean)) ?
231+
commandLine.optionValue('features').toString()?.split(',')?.toList() : []) : null
230232
Map<String, String> args = getCommandArguments(commandLine)
231233

232234
CreateAppCommandObject cmd = new CreateAppCommandObject(
@@ -356,9 +358,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
356358
console.println(" Name:".padRight(20) + appName)
357359
console.println(" Package:".padRight(20) + defaultPackageName)
358360
console.println(" Profile:".padRight(20) + profileName)
359-
if (features) {
360-
console.println(" Features:".padRight(20) + features*.name?.join(', '))
361-
}
361+
console.println(" Features:".padRight(20) + features*.name?.join(', '))
362362
if (cmd.template) {
363363
console.println(" Template:".padRight(20) + cmd.template)
364364
}
@@ -415,7 +415,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
415415

416416
protected List<Feature> evaluateFeatures(Profile profile, List<String> requestedFeatures, GrailsConsole console) {
417417
List<Feature> features
418-
if (requestedFeatures) {
418+
if (requestedFeatures != null && requestedFeatures.size() > 0) {
419419
List<String> allFeatureNames = profile.features*.name
420420
Collection<String> validFeatureNames = requestedFeatures.intersect(allFeatureNames)
421421
requestedFeatures.removeAll(allFeatureNames)
@@ -432,6 +432,9 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
432432
}
433433
features = (profile.features.findAll { Feature f -> validFeatureNames.contains(f.name) } + profile.requiredFeatures).unique()
434434
}
435+
else if (requestedFeatures != null && requestedFeatures.size() == 0) {
436+
features = Collections.emptyList()
437+
}
435438
else {
436439
features = (profile.defaultFeatures + profile.requiredFeatures).toList().unique()
437440
}

0 commit comments

Comments
 (0)