-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added CommandRegistry interface, fixes #480
- Loading branch information
Showing
2 changed files
with
87 additions
and
4 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
60 changes: 60 additions & 0 deletions
60
builtins/src/main/java/org/jline/builtins/CommandRegistry.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,60 @@ | ||
/* | ||
* Copyright (c) 2002-2019, the original author or authors. | ||
* | ||
* This software is distributable under the BSD license. See the terms of the | ||
* BSD license in the documentation provided with this software. | ||
* | ||
* https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
package org.jline.builtins; | ||
|
||
import org.jline.builtins.Completers; | ||
import org.jline.builtins.Widgets; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
public interface CommandRegistry { | ||
|
||
/** | ||
* Returns the command names known by this registry. | ||
* @return the set of known command names, excluding aliases | ||
*/ | ||
Set<String> commandNames(); | ||
|
||
/** | ||
* Returns a map of alias-to-command names known by this registry. | ||
* @return a map with alias keys and command name values | ||
*/ | ||
Map<String, String> commandAliases(); | ||
|
||
/** | ||
* Returns a short info about command known by this registry. | ||
* @return a short info about command | ||
*/ | ||
List<String> commandInfo(String command); | ||
|
||
/** | ||
* Returns whether a command with the specified name is known to this registry. | ||
* @param command the command name to test | ||
* @return true if the specified command is registered | ||
*/ | ||
boolean hasCommand(String command); | ||
|
||
/** | ||
* Returns a {@code SystemCompleter} that can provide detailed completion | ||
* information for all registered commands. | ||
* | ||
* @return a SystemCompleter that can provide command completion for all registered commands | ||
*/ | ||
Completers.SystemCompleter compileCompleters(); | ||
|
||
/** | ||
* Returns a command description for use in the JLine Widgets framework. | ||
* @param command name of the command whose description to return | ||
* @return command description for JLine TailTipWidgets to be displayed | ||
* in the terminal status bar. | ||
*/ | ||
Widgets.CmdDesc commandDescription(String command); | ||
} |