Skip to content

Commit

Permalink
Added dev cli help for test command
Browse files Browse the repository at this point in the history
  • Loading branch information
sdaschner committed Mar 18, 2023
1 parent bd51374 commit 1c96751
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.quarkus.deployment.console;

import org.aesh.command.CommandException;
import org.aesh.command.CommandResult;
import org.aesh.command.GroupCommand;
import org.aesh.command.invocation.CommandInvocation;
import org.aesh.command.option.Option;

public abstract class QuarkusGroupCommand implements GroupCommand {

@Option(shortName = 'h', hasValue = false, overrideRequired = true)
public boolean help;

@Override
public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
commandInvocation.getShell().write(commandInvocation.getHelpInfo());
return CommandResult.SUCCESS;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Set;
import java.util.function.BiFunction;

import io.quarkus.deployment.console.QuarkusGroupCommand;
import org.aesh.command.Command;
import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandException;
Expand Down Expand Up @@ -197,24 +198,24 @@ ConsoleCommandBuildItem testConsoleCommand(CombinedIndexBuildItem indexBuildItem
return new ConsoleCommandBuildItem(new TestCommand());
}

@GroupCommandDefinition(name = "test", description = "Test Commands", groupCommands = { TagsCommand.class,
PatternCommand.class })
public static class TestCommand implements Command {
@GroupCommandDefinition(name = "test", description = "Test Commands")
public static class TestCommand extends QuarkusGroupCommand {

@Override
public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
return CommandResult.SUCCESS;
public List<Command> getCommands() {
return List.of(new TagsCommand(), new PatternCommand());
}

}

@GroupCommandDefinition(name = "tags", description = "Tag Commands", groupCommands = { IncludeTagsCommand.class,
ExcludeTagsCommand.class })
public static class TagsCommand implements Command {
@GroupCommandDefinition(name = "tags", description = "Tag Commands")
public static class TagsCommand extends QuarkusGroupCommand {

@Override
public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
return CommandResult.SUCCESS;
public List<Command> getCommands() {
return List.of(new IncludeTagsCommand(), new ExcludeTagsCommand());
}

}

@CommandDefinition(name = "include", description = "Sets the current included tags")
Expand Down Expand Up @@ -269,15 +270,14 @@ protected void configure(TestSupport testSupport) {
}
}

@GroupCommandDefinition(name = "pattern", description = "Include/Exclude pattern Commands", groupCommands = {
IncludePatternCommand.class,
ExcludePatternCommand.class })
public static class PatternCommand implements Command {
@GroupCommandDefinition(name = "pattern", description = "Include/Exclude pattern Commands")
public static class PatternCommand extends QuarkusGroupCommand {

@Override
public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
return CommandResult.SUCCESS;
public List<Command> getCommands() {
return List.of(new IncludePatternCommand(), new ExcludePatternCommand());
}

}

@CommandDefinition(name = "include", description = "Sets the current include pattern")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import java.util.logging.LogRecord;
import java.util.stream.Collectors;

import io.quarkus.deployment.console.QuarkusGroupCommand;
import org.aesh.command.Command;
import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandException;
import org.aesh.command.CommandResult;
import org.aesh.command.GroupCommand;
import org.aesh.command.GroupCommandDefinition;
import org.aesh.command.completer.CompleterInvocation;
import org.aesh.command.completer.OptionCompleter;
Expand Down Expand Up @@ -653,21 +653,13 @@ ConsoleCommandBuildItem logConsoleCommand() {
}

@GroupCommandDefinition(name = "log", description = "Logging Commands")
public static class LogCommand implements GroupCommand {

@Option(shortName = 'h', hasValue = false, overrideRequired = true)
public boolean help;
public static class LogCommand extends QuarkusGroupCommand {

@Override
public List<Command> getCommands() {
return List.of(new SetLogLevelCommand());
}

@Override
public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
commandInvocation.getShell().writeln(commandInvocation.getHelpInfo());
return CommandResult.SUCCESS;
}
}

@CommandDefinition(name = "set-level", description = "Sets the log level for a logger")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@

import java.util.List;

import io.quarkus.deployment.console.QuarkusGroupCommand;
import org.aesh.command.Command;
import org.aesh.command.CommandException;
import org.aesh.command.CommandResult;
import org.aesh.command.GroupCommand;
import org.aesh.command.GroupCommandDefinition;
import org.aesh.command.invocation.CommandInvocation;
import org.aesh.command.option.Option;

import io.quarkus.deployment.builditem.DevServicesLauncherConfigResultBuildItem;

@GroupCommandDefinition(name = "postgres", description = "Postgresql Commands")
public class PostgresCommand implements GroupCommand {
public class PostgresCommand extends QuarkusGroupCommand {

private final DevServicesLauncherConfigResultBuildItem devServicesLauncherConfigResultBuildItem;

@Option(shortName = 'h', hasValue = false, overrideRequired = true)
public boolean help;

public PostgresCommand(DevServicesLauncherConfigResultBuildItem devServicesLauncherConfigResultBuildItem) {
this.devServicesLauncherConfigResultBuildItem = devServicesLauncherConfigResultBuildItem;
}
Expand All @@ -29,9 +22,4 @@ public List<Command> getCommands() {
return List.of(new PsqlCommand(devServicesLauncherConfigResultBuildItem));
}

@Override
public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
commandInvocation.getShell().writeln(commandInvocation.getHelpInfo());
return CommandResult.SUCCESS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@
import java.util.Set;
import java.util.stream.Collectors;

import io.quarkus.deployment.console.QuarkusGroupCommand;
import org.aesh.command.Command;
import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandException;
import org.aesh.command.CommandResult;
import org.aesh.command.GroupCommand;
import org.aesh.command.GroupCommandDefinition;
import org.aesh.command.completer.CompleterInvocation;
import org.aesh.command.completer.OptionCompleter;
import org.aesh.command.invocation.CommandInvocation;
import org.aesh.command.option.Argument;
import org.aesh.command.option.Option;
import org.aesh.command.validator.CommandValidator;
import org.aesh.command.validator.CommandValidatorException;

Expand Down Expand Up @@ -313,13 +312,10 @@ public static boolean isSetByDevServices(Optional<DevServicesLauncherConfigResul
}

@GroupCommandDefinition(name = "config", description = "Config Editing Commands")
public static class ConfigCommandGroup implements GroupCommand {
public static class ConfigCommandGroup extends QuarkusGroupCommand {

final ConfigDescriptionsManager configDescriptionsManager;

@Option(shortName = 'h', hasValue = false, overrideRequired = true)
public boolean help;

public ConfigCommandGroup(ConfigDescriptionsManager configDescriptionsManager) {
this.configDescriptionsManager = configDescriptionsManager;
}
Expand All @@ -329,11 +325,6 @@ public List<Command> getCommands() {
return List.of(new SetConfigCommand(configDescriptionsManager));
}

@Override
public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
commandInvocation.getShell().writeln(commandInvocation.getHelpInfo());
return CommandResult.SUCCESS;
}
}

@CommandDefinition(name = "set", description = "Sets a config value", validator = SetValidator.class)
Expand Down

0 comments on commit 1c96751

Please sign in to comment.