diff --git a/mvnsh-commands/mvnsh-maven/src/main/java/com/planet57/maven/shell/commands/maven/MavenAction.java b/mvnsh-commands/mvnsh-maven/src/main/java/com/planet57/maven/shell/commands/maven/MavenAction.java index 491ddf7..e35df70 100644 --- a/mvnsh-commands/mvnsh-maven/src/main/java/com/planet57/maven/shell/commands/maven/MavenAction.java +++ b/mvnsh-commands/mvnsh-maven/src/main/java/com/planet57/maven/shell/commands/maven/MavenAction.java @@ -51,12 +51,14 @@ public class MavenAction implements OpaqueArguments { @Inject - public void installCompleters(@Named("maven-phase") final Completer c1, - @Named("maven-plugin") final Completer c2) + public void installCompleters(@Named("maven-option") final Completer c1, + @Named("maven-phase") final Completer c2, + @Named("maven-plugin") final Completer c3) { checkNotNull(c1); checkNotNull(c2); - setCompleters(new AggregateCompleter(c1, c2)); + checkNotNull(c3); + setCompleters(new AggregateCompleter(c1, c2, c3)); } @Override diff --git a/mvnsh-commands/mvnsh-maven/src/main/java/com/planet57/maven/shell/commands/maven/MavenOptionCompleter.java b/mvnsh-commands/mvnsh-maven/src/main/java/com/planet57/maven/shell/commands/maven/MavenOptionCompleter.java new file mode 100644 index 0000000..fd0fddd --- /dev/null +++ b/mvnsh-commands/mvnsh-maven/src/main/java/com/planet57/maven/shell/commands/maven/MavenOptionCompleter.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2009-present the original author or authors. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Apache License v2.0 which accompanies this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * The Apache License v2.0 is available at + * http://www.apache.org/licenses/LICENSE-2.0.html + * + * You may elect to redistribute this code under either of these licenses. + */ + +package com.planet57.maven.shell.commands.maven; + +import java.util.List; + +import javax.inject.Named; +import javax.inject.Singleton; + +import org.jline.reader.Candidate; +import org.jline.reader.Completer; +import org.jline.reader.LineReader; +import org.jline.reader.ParsedLine; + +import com.planet57.gshell.util.jline.StringsCompleter2; + +/** + * Maven option completer. + * + * @since 3.0 + */ +@Named("maven-option") +@Singleton +public class MavenOptionCompleter + implements Completer +{ + private final StringsCompleter2 delegate = new StringsCompleter2(); + + public MavenOptionCompleter() { + delegate.addAll( + "-am", "--also-make", + "-B", "--batch-mode", + "-e", "--errors", + "-N", "--non-recursive", + "-X", "--debug" + ); + } + + @Override + public void complete(final LineReader reader, final ParsedLine line, final List candidates) { + delegate.complete(reader, line, candidates); + } +}