Skip to content

Commit

Permalink
Better message for suggest
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Francois Denise committed Mar 28, 2024
1 parent 2c7570d commit 5b8cda5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public Integer call() throws Exception {
throw new Exception("Can only set a docker image name when provisioning a docker image. Remove the " + Constants.DOCKER_IMAGE_NAME_OPTION + " option");
}
}
builder.setIsCli(true);
ScanResults scanResults = GlowSession.scan(MavenResolver.newMavenResolver(), builder.build(), GlowMessageWriter.DEFAULT);
scanResults.outputInformation();
if (provision.isEmpty()) {
Expand Down
13 changes: 12 additions & 1 deletion core/src/main/java/org/wildfly/glow/Arguments.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class Arguments implements GoOfflineArguments, ScanArguments {
private final Set<Pattern> excludeArchivesFromScan;
private final Stability configStability;
private final Stability packageStability;
private final boolean isCli;

protected Arguments(
String executionContext,
Expand All @@ -51,7 +52,8 @@ protected Arguments(
boolean techPreview,
Set<Pattern> excludeArchivesFromScan,
Stability configStability,
Stability packageStability) {
Stability packageStability,
boolean isCli) {
this.executionProfiles = executionProfiles;
this.userEnabledAddOns = userEnabledAddOns;
this.binaries = binaries;
Expand All @@ -76,6 +78,7 @@ protected Arguments(
} else {
this.manualLayers = new HashSet<>(Arrays.asList(manualLayers.split(",")));
}
this.isCli = isCli;
}

/**
Expand Down Expand Up @@ -191,6 +194,14 @@ public Stability getPackageStability() {
return packageStability;
}

/**
* @return the isCli
*/
@Override
public boolean isCli() {
return isCli;
}

static GoOfflineArguments.Builder goOfflineBuilder() {
return new GoOfflineArguments.Builder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class BaseArgumentsBuilder {
protected Set<String> excludeJarsFromScan = Collections.emptySet();
protected Stability packageStability;
protected Stability configStability;
protected boolean isCli;

protected BaseArgumentsBuilder() {

Expand All @@ -67,6 +68,7 @@ public Arguments build() {
techPreview,
excludeJarsFromScan,
configStability,
packageStability);
packageStability,
isCli);
}
}
5 changes: 5 additions & 0 deletions core/src/main/java/org/wildfly/glow/ScanArguments.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public interface ScanArguments {

Stability getConfigStability();
Stability getPackageStability();
boolean isCli();

default Builder createScanArgumentsBuilder() {
return new Builder();
Expand Down Expand Up @@ -163,5 +164,9 @@ public Builder setConfigStability(Stability stability) {
this.configStability = stability;
return this;
}
public Builder setIsCli(boolean isCli) {
this.isCli = isCli;
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private void detailed(ScanArguments arguments, ScanResults scanResults) throws E
}
} else {
if (!scanResults.getSuggestions().getPossibleAddOns().isEmpty() || !scanResults.getSuggestions().getPossibleAddOns().isEmpty() || !suggestedConfigs.isEmpty() || !suggestedBuildTimeConfigs.isEmpty()) {
writer.info("Some suggestions have been found. You could enable suggestions with the --suggest option (if using the WildFly Glow CLI) or <suggest>true</suggest> (if using the WildFly Maven Plugin).");
writer.info("Some suggestions have been found. You could enable suggestions with the " + (arguments.isCli() ? "--suggest" : "<suggest>true</suggest>") + " option.");
}
}
}
Expand Down

0 comments on commit 5b8cda5

Please sign in to comment.