- java.lang.Object
-
- picocli.shell.jline3.PicocliCommands
-
- All Implemented Interfaces:
org.jline.console.CommandRegistry
public class PicocliCommands extends Object implements org.jline.console.CommandRegistry
Compiles SystemCompleter for command completion and implements a method commandDescription() that provides command descriptions for JLine TailTipWidgets to be displayed in terminal status bar. SystemCompleter implements the JLine 3Completer
interface. SystemCompleter generates completion candidates for the specified command line based on theCommandLine.Model.CommandSpec
that thisPicocliCommands
was constructed with.- Since:
- 4.1.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PicocliCommands.ClearScreen
Command that clears the screen.static class
PicocliCommands.PicocliCommandsFactory
Command factory that is necessary for applications that want the use theClearScreen
subcommand.
-
Constructor Summary
Constructors Constructor Description PicocliCommands(CommandLine cmd)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
commandAliases()
org.jline.console.CmdDesc
commandDescription(String command)
org.jline.console.CmdDesc
commandDescription(List<String> args)
List<String>
commandInfo(String command)
Set<String>
commandNames()
org.jline.reader.impl.completer.SystemCompleter
compileCompleters()
Object
execute(org.jline.console.CommandRegistry.CommandSession session, String command, String[] args)
boolean
hasCommand(String command)
Object
invoke(org.jline.console.CommandRegistry.CommandSession session, String command, Object... args)
String
name()
Returns the name shown for this collection of picocli commands in the usage help message.void
name(String newName)
Sets the name shown for this collection of picocli commands in the usage help message.
-
-
-
Constructor Detail
-
PicocliCommands
public PicocliCommands(CommandLine cmd)
-
-
Method Detail
-
hasCommand
public boolean hasCommand(String command)
- Specified by:
hasCommand
in interfaceorg.jline.console.CommandRegistry
- Parameters:
command
-- Returns:
- true if PicocliCommands contains command
-
compileCompleters
public org.jline.reader.impl.completer.SystemCompleter compileCompleters()
- Specified by:
compileCompleters
in interfaceorg.jline.console.CommandRegistry
-
commandDescription
public org.jline.console.CmdDesc commandDescription(List<String> args)
- Specified by:
commandDescription
in interfaceorg.jline.console.CommandRegistry
- Parameters:
args
-- Returns:
- command description for JLine TailTipWidgets to be displayed in terminal status bar.
-
commandInfo
public List<String> commandInfo(String command)
- Specified by:
commandInfo
in interfaceorg.jline.console.CommandRegistry
-
invoke
public Object invoke(org.jline.console.CommandRegistry.CommandSession session, String command, Object... args) throws Exception
- Specified by:
invoke
in interfaceorg.jline.console.CommandRegistry
- Throws:
Exception
-
execute
public Object execute(org.jline.console.CommandRegistry.CommandSession session, String command, String[] args) throws Exception
- Throws:
Exception
-
commandNames
public Set<String> commandNames()
- Specified by:
commandNames
in interfaceorg.jline.console.CommandRegistry
-
commandAliases
public Map<String,String> commandAliases()
- Specified by:
commandAliases
in interfaceorg.jline.console.CommandRegistry
-
commandDescription
public org.jline.console.CmdDesc commandDescription(String command)
-
name
public String name()
Returns the name shown for this collection of picocli commands in the usage help message. If not set withname(String)
, this returnsCommandRegistry.name()
.- Specified by:
name
in interfaceorg.jline.console.CommandRegistry
- Returns:
- the name shown for this collection of picocli commands in the usage help message
-
name
public void name(String newName)
Sets the name shown for this collection of picocli commands in the usage help message.- Parameters:
newName
- the new name to show
-
-