use of org.jboss.as.cli.handlers.SimpleTabCompleter in project wildfly-core by wildfly.
the class EmbedHostControllerHandler method create.
static EmbedHostControllerHandler create(final AtomicReference<EmbeddedProcessLaunch> hostControllerReference, final CommandContext ctx, final boolean modular) {
EmbedHostControllerHandler result = new EmbedHostControllerHandler(hostControllerReference);
final FilenameTabCompleter pathCompleter = FilenameTabCompleter.newCompleter(ctx);
if (!modular) {
result.jbossHome = new FileSystemPathArgument(result, pathCompleter, "--jboss-home");
}
result.stdOutHandling = new ArgumentWithValue(result, new SimpleTabCompleter(new String[] { ECHO, DISCARD_STDOUT }), "--std-out");
result.domainConfig = new ArgumentWithValue(result, DOMAIN_CONFIG);
result.hostConfig = new ArgumentWithValue(result, HOST_CONFIG);
result.dashC = new ArgumentWithValue(result, "-c");
result.dashC.addCantAppearAfter(result.domainConfig);
result.domainConfig.addCantAppearAfter(result.dashC);
result.timeout = new ArgumentWithValue(result, "--timeout");
result.emptyDomainConfig = new ArgumentWithoutValue(result, EMPTY_DOMAIN_CONFIG);
result.removeExistingDomainConfig = new ArgumentWithoutValue(result, REMOVE_EXISTING_DOMAIN_CONFIG);
result.emptyHostConfig = new ArgumentWithoutValue(result, EMPTY_HOST_CONFIG);
result.removeExistingHostConfig = new ArgumentWithoutValue(result, REMOVE_EXISTING_HOST_CONFIG);
return result;
}
use of org.jboss.as.cli.handlers.SimpleTabCompleter in project wildfly-core by wildfly.
the class DefaultOperationCandidatesProvider method getAllowedCompleter.
private static CommandLineCompleter getAllowedCompleter(final Property prop) {
final ModelNode allowedNode = prop.getValue().get(Util.ALLOWED);
if (allowedNode.isDefined()) {
final List<ModelNode> nodeList = allowedNode.asList();
final String[] values = new String[nodeList.size()];
for (int i = 0; i < values.length; ++i) {
values[i] = nodeList.get(i).asString();
}
return new SimpleTabCompleter(values);
}
return null;
}
use of org.jboss.as.cli.handlers.SimpleTabCompleter in project wildfly-core by wildfly.
the class MockOperationCandidatesProvider method getProperties.
@Override
public List<CommandArgument> getProperties(CommandContext ctx, String operationName, OperationRequestAddress address) {
MockOperation operation = root.getOperation(operationName);
if (operation == null) {
return Collections.emptyList();
}
final List<MockOperationProperty> properties = operation.getProperties();
final List<CommandArgument> result = new ArrayList<CommandArgument>(properties.size());
for (final MockOperationProperty property : properties) {
String name = property.getName();
result.add(new CommandArgument() {
@Override
public String getFullName() {
return name;
}
@Override
public String getShortName() {
return null;
}
@Override
public int getIndex() {
return -1;
}
@Override
public boolean isPresent(ParsedCommandLine args) throws CommandFormatException {
return args.hasProperty(name);
}
@Override
public boolean canAppearNext(CommandContext ctx) throws CommandFormatException {
ParsedCommandLine args = ctx.getParsedCommandLine();
if (isPresent(args)) {
return !isValueComplete(args);
}
return true;
}
@Override
public String getValue(ParsedCommandLine args) throws CommandFormatException {
return args.getPropertyValue(name);
}
@Override
public String getValue(ParsedCommandLine args, boolean required) throws CommandFormatException {
if (!isPresent(args)) {
throw new CommandFormatException("Property '" + name + "' is missing required value.");
}
return args.getPropertyValue(name);
}
@Override
public boolean isValueComplete(ParsedCommandLine args) throws CommandFormatException {
if (!isPresent(args)) {
return false;
}
if (name.equals(args.getLastParsedPropertyName()) && !args.isLastPropertyNegated()) {
return false;
}
return true;
}
@Override
public boolean isValueRequired() {
return property.isValueRequired();
}
@Override
public CommandLineCompleter getValueCompleter() {
return property.getPossibleValues() != null ? new SimpleTabCompleter(property.getPossibleValues()) : null;
}
});
}
return result;
}
use of org.jboss.as.cli.handlers.SimpleTabCompleter in project wildfly-core by wildfly.
the class EmbedServerHandler method create.
static EmbedServerHandler create(final AtomicReference<EmbeddedProcessLaunch> serverReference, CommandContext ctx, boolean modular) {
EmbedServerHandler result = new EmbedServerHandler(serverReference);
final FilenameTabCompleter pathCompleter = FilenameTabCompleter.newCompleter(ctx);
if (!modular) {
result.jbossHome = new FileSystemPathArgument(result, pathCompleter, "--jboss-home");
}
result.stdOutHandling = new ArgumentWithValue(result, new SimpleTabCompleter(new String[] { ECHO, DISCARD_STDOUT }), "--std-out");
result.serverConfig = new ArgumentWithValue(result, "--server-config");
result.dashC = new ArgumentWithValue(result, "-c");
result.dashC.addCantAppearAfter(result.serverConfig);
result.serverConfig.addCantAppearAfter(result.dashC);
result.adminOnly = new ArgumentWithValue(result, SimpleTabCompleter.BOOLEAN, "--admin-only");
result.emptyConfig = new ArgumentWithoutValue(result, "--empty-config");
result.removeExisting = new ArgumentWithoutValue(result, "--remove-existing");
result.removeExisting.addRequiredPreceding(result.emptyConfig);
result.timeout = new ArgumentWithValue(result, "--timeout");
return result;
}
Aggregations