-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add minimal option mvn option completer
- Loading branch information
Showing
2 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...nsh-maven/src/main/java/com/planet57/maven/shell/commands/maven/MavenOptionCompleter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Candidate> candidates) { | ||
delegate.complete(reader, line, candidates); | ||
} | ||
} |