gnodet commented on code in PR #2117:
URL: https://github.com/apache/maven/pull/2117#discussion_r1967309050
##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/builtin/BuiltinShellCommandRegistryFactory.java:
##########
@@ -75,15 +75,14 @@ private BuiltinShellCommandRegistry(LookupContext
shellContext) {
this.mavenParser = new MavenParser();
this.shellEncryptInvoker = new
EncryptInvoker(shellContext.invokerRequest.lookup(), contextCopier());
this.encryptParser = new EncryptParser();
- Set<Command> commands = new
HashSet<>(EnumSet.allOf(Command.class));
- Map<Command, String> commandName = new HashMap<>();
- Map<Command, CommandMethods> commandExecute = new HashMap<>();
- for (Command c : commands) {
- commandName.put(c, c.name().toLowerCase());
- }
- commandExecute.put(Command.MVN, new CommandMethods(this::mvn,
this::mvnCompleter));
- commandExecute.put(Command.MVNENC, new
CommandMethods(this::mvnenc, this::mvnencCompleter));
- registerCommands(commandName, commandExecute);
+ Map<String, CommandMethods> commandExecute = new HashMap<>();
+ commandExecute.put("!", new CommandMethods(this::shell,
this::defaultCompleter));
+ commandExecute.put("cd", new CommandMethods(this::cd,
this::cdCompleter));
+ commandExecute.put("ls", new CommandMethods(this::ls,
this::defaultCompleter));
Review Comment:
JLine [defines a bunch of
commands](https://github.com/jline/jline3/blob/master/demo/src/main/java/org/apache/felix/gogo/jline/Posix.java)
already. They are currently leveraging Felix Gogo, but it should be fairly
easy to abstract from it and make them reusable.
Would that make sense to reuse them here ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]