Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder constants, channels instead of channels-file #64

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 26 additions & 42 deletions cli/src/main/java/org/wildfly/glow/cli/commands/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,27 @@
*/
public interface Constants {

String HA = "ha";

String COMPLETION_COMMAND = "completion";
String GO_OFFLINE_COMMAND = "go-offline";
String SCAN_COMMAND = "scan";
String SHOW_ADD_ONS_COMMAND = "show-add-ons";
String SHOW_CONFIGURATION_COMMAND = "show-configuration";
String SHOW_SERVER_VERSIONS_COMMAND = "show-server-versions";
String ADD_LAYERS_FOR_JNDI_OPTION = "--add-layers-for-jndi";
String ADD_LAYERS_FOR_JNDI_OPTION_LABEL = "<layer>";
String ADD_ONS_OPTION = "--add-ons";
String ADD_ONS_OPTION_LABEL = "<add-on>";
String ADD_ONS_OPTION_SHORT = "-ao";

String ADD_LAYERS_FOR_JNDI_OPTION = "--add-layers-for-jndi";
String ADD_LAYERS_FOR_JNDI_OPTION_LABEL = "<layer>";
String BATCH_OPTION = "--batch";
String BATCH_OPTION_SHORT = "-B";

String BUILD_ENV_FILE_OPTION = "--build-env-file";
String BUILD_ENV_FILE_OPTION_SHORT = "-bef";
String BUILD_ENV_FILE_OPTION_LABEL = "<build env file path>";

String CHANNELS_OPTION = "--channels";
String CHANNELS_OPTION_SHORT = "-cc";
String CHANNELS_OPTION_LABEL = "<Channels yaml file path>";
String CLI_SCRIPT_OPTION = "--cli-script";
String CLI_SCRIPT_OPTION_SHORT = "-cs";
String CLI_SCRIPT_OPTION_LABEL = "<CLI script file path>";
String CLOUD_OPTION = "--cloud";
String CLOUD_OPTION_SHORT = "-c";
String COMPLETION_COMMAND = "completion";
String CONFIG_STABILITY_OPTION = "--config-stability-level";
String CONFIG_STABILITY_OPTION_SHORT = "-csl";
String DISABLE_DEPLOYERS = "--disable-deployers";
String DISABLE_DEPLOYERS_LABEL = "<ALL|deployer name>";
String DOCKER_IMAGE_NAME_OPTION = "--docker-image-name";
Expand All @@ -59,59 +57,45 @@ public interface Constants {
String FAILS_ON_ERROR_OPTION = "--fails-on-error";
String FAILS_ON_ERROR_OPTION_SHORT = "-foe";
String HA_OPTION = "--ha";

String GO_OFFLINE_COMMAND = "go-offline";
String HA = "ha";
String HELP_OPTION = "--help";
String HELP_OPTION_SHORT = "-h";
String CHANNELS_FILE_OPTION = "--channels-file";
String CHANNELS_FILE_OPTION_SHORT = "-cf";
String CHANNELS_FILE_OPTION_LABEL = "<Channels yaml file path>";
String CLI_SCRIPT_OPTION = "--cli-script";
String CLI_SCRIPT_OPTION_SHORT = "-cs";
String CLI_SCRIPT_OPTION_LABEL = "<CLI script file path>";
String INIT_SCRIPT_OPTION = "--init-script";
String INIT_SCRIPT_OPTION_SHORT = "-is";
String INIT_SCRIPT_OPTION_LABEL = "<init script file path>";
String INPUT_FEATURE_PACKS_FILE_OPTION = "--input-feature-packs-file";
String INPUT_FEATURE_PACKS_FILE_OPTION_LABEL = "<provisioning file path>";
String NO_DOCKER_IMAGE_OPTION = "--no-docker-image";
String NO_DOCKER_IMAGE_OPTION_SHORT = "-nd";
String PACKAGE_STABILITY_OPTION = "--package-stability-level";
String PACKAGE_STABILITY_OPTION_SHORT = "-psl";
String PROVISION_OPTION = "--provision";
String PROVISION_OPTION_LABEL = "<SERVER|BOOTABLE_JAR|OPENSHIFT|DOCKER_IMAGE|PROVISIONING_XML>";
String PROVISION_OPTION_SHORT = "-p";
String PROVISION_OUTPUT_DIR_OPTION = "--output-dir";
String PROVISION_OUTPUT_DIR_OPTION_SHORT = "-d";
String PROVISION_OUTPUT_DIR_LABEL = "<output directory>";
String SCAN_COMMAND = "scan";
String SERVER_VERSION_OPTION = "--server-version";
String SERVER_VERSION_OPTION_SHORT = "-sv";
String SERVER_VERSION_OPTION_LABEL = "<server version>";
String SHOW_ADD_ONS_COMMAND = "show-add-ons";
String SHOW_CONFIGURATION_COMMAND = "show-configuration";
String SHOW_SERVER_VERSIONS_COMMAND = "show-server-versions";
String STABILITY_LABEL = "<default|community|preview|experimental>";
String STABILITY_OPTION = "--stability-level";
String STABILITY_OPTION_SHORT = "-sl";
String SYSTEM_PROPERTIES_LABEL = "\"<-DpropName[=value] [-DpropName[=value]]>\"";
String SYSTEM_PROPERTIES_OPTION = "--properties";
String SYSTEM_PROPERTIES_OPTION_SHORT = "-pp";
String SUGGEST_OPTION = "--suggest";
String SUGGEST_OPTION_SHORT = "-s";

String VERBOSE_OPTION = "--verbose";
String VERBOSE_OPTION_SHORT = "-vv";

String VERSION_OPTION = "--version";
String VERSION_OPTION_SHORT = "-v";

String WILDFLY_GLOW = "wildfly-glow";
String WILDFLY_PREVIEW_OPTION = "--wildfly-preview";
String WILDFLY_PREVIEW_OPTION_SHORT = "-wp";

String WILDFLY_GLOW = "wildfly-glow";

String PROVISION_OUTPUT_DIR_OPTION = "--output-dir";

String PROVISION_OUTPUT_DIR_OPTION_SHORT = "-d";

String PROVISION_OUTPUT_DIR_LABEL = "<output directory>";

String STABILITY_OPTION = "--stability-level";
String STABILITY_OPTION_SHORT = "-sl";

String PACKAGE_STABILITY_OPTION = "--package-stability-level";
String PACKAGE_STABILITY_OPTION_SHORT = "-psl";

String CONFIG_STABILITY_OPTION = "--config-stability-level";
String CONFIG_STABILITY_OPTION_SHORT = "-csl";

String STABILITY_LABEL = "<default|community|preview|experimental>";
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public OutputFormat convert(String value) throws Exception {
@CommandLine.Option(names = {Constants.FAILS_ON_ERROR_OPTION_SHORT, Constants.FAILS_ON_ERROR_OPTION}, defaultValue = "true")
Optional<Boolean> failsOnError;

@CommandLine.Option(names = {Constants.CHANNELS_FILE_OPTION_SHORT, Constants.CHANNELS_FILE_OPTION}, paramLabel = Constants.CHANNELS_FILE_OPTION_LABEL)
@CommandLine.Option(names = {Constants.CHANNELS_OPTION_SHORT, Constants.CHANNELS_OPTION}, paramLabel = Constants.CHANNELS_OPTION_LABEL)
Optional<Path> channelsFile;

@Override
Expand Down Expand Up @@ -195,13 +195,13 @@ public Integer call() throws Exception {
}
if (wildflyPreview.orElse(false)) {
if (channelsFile.isPresent()) {
throw new Exception(Constants.WILDFLY_PREVIEW_OPTION + "can't be set when " + Constants.CHANNELS_FILE_OPTION + " is set.");
throw new Exception(Constants.WILDFLY_PREVIEW_OPTION + "can't be set when " + Constants.CHANNELS_OPTION + " is set.");
}
builder.setTechPreview(true);
}
if (wildflyServerVersion.isPresent()) {
if (channelsFile.isPresent()) {
throw new Exception(Constants.SERVER_VERSION_OPTION + "can't be set when " + Constants.CHANNELS_FILE_OPTION + " is set.");
throw new Exception(Constants.SERVER_VERSION_OPTION + "can't be set when " + Constants.CHANNELS_OPTION + " is set.");
}
builder.setVersion(wildflyServerVersion.get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class ShowAddOnsCommand extends AbstractCommand {
@CommandLine.Option(names = Constants.INPUT_FEATURE_PACKS_FILE_OPTION, paramLabel = Constants.INPUT_FEATURE_PACKS_FILE_OPTION_LABEL)
Optional<Path> provisioningXml;

@CommandLine.Option(names = {Constants.CHANNELS_FILE_OPTION_SHORT, Constants.CHANNELS_FILE_OPTION}, paramLabel = Constants.CHANNELS_FILE_OPTION_LABEL)
@CommandLine.Option(names = {Constants.CHANNELS_OPTION_SHORT, Constants.CHANNELS_OPTION}, paramLabel = Constants.CHANNELS_OPTION_LABEL)
Optional<Path> channelsFile;

@Override
Expand All @@ -61,12 +61,12 @@ public Integer call() throws Exception {
}
if (wildflyPreview.orElse(false)) {
if (channelsFile.isPresent()) {
throw new Exception(Constants.WILDFLY_PREVIEW_OPTION + "can't be set when " + Constants.CHANNELS_FILE_OPTION + " is set.");
throw new Exception(Constants.WILDFLY_PREVIEW_OPTION + "can't be set when " + Constants.CHANNELS_OPTION + " is set.");
}
}
if (wildflyServerVersion.isPresent()) {
if (channelsFile.isPresent()) {
throw new Exception(Constants.SERVER_VERSION_OPTION + "can't be set when " + Constants.CHANNELS_FILE_OPTION + " is set.");
throw new Exception(Constants.SERVER_VERSION_OPTION + "can't be set when " + Constants.CHANNELS_OPTION + " is set.");
}
}
ProvisioningUtils.ProvisioningConsumer consumer = new ProvisioningConsumer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class ShowConfigurationCommand extends AbstractCommand {
@CommandLine.Option(names = Constants.INPUT_FEATURE_PACKS_FILE_OPTION, paramLabel = Constants.INPUT_FEATURE_PACKS_FILE_OPTION_LABEL)
Optional<Path> provisioningXml;

@CommandLine.Option(names = {Constants.CHANNELS_FILE_OPTION_SHORT, Constants.CHANNELS_FILE_OPTION}, paramLabel = Constants.CHANNELS_FILE_OPTION_LABEL)
@CommandLine.Option(names = {Constants.CHANNELS_OPTION_SHORT, Constants.CHANNELS_OPTION}, paramLabel = Constants.CHANNELS_OPTION_LABEL)
Optional<Path> channelsFile;

@Override
Expand All @@ -76,12 +76,12 @@ public Integer call() throws Exception {
}
if (wildflyPreview.orElse(false)) {
if (channelsFile.isPresent()) {
throw new Exception(Constants.WILDFLY_PREVIEW_OPTION + "can't be set when " + Constants.CHANNELS_FILE_OPTION + " is set.");
throw new Exception(Constants.WILDFLY_PREVIEW_OPTION + "can't be set when " + Constants.CHANNELS_OPTION + " is set.");
}
}
if (wildflyServerVersion.isPresent()) {
if (channelsFile.isPresent()) {
throw new Exception(Constants.SERVER_VERSION_OPTION + "can't be set when " + Constants.CHANNELS_FILE_OPTION + " is set.");
throw new Exception(Constants.SERVER_VERSION_OPTION + "can't be set when " + Constants.CHANNELS_OPTION + " is set.");
}
}
String finalContext = context;
Expand Down
Loading
Loading