Package picocli.shell.jline3
Class PicocliCommands
- java.lang.Object
-
- picocli.shell.jline3.PicocliCommands
-
- All Implemented Interfaces:
org.jline.console.CommandRegistry
public class PicocliCommands extends java.lang.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.private class
PicocliCommands.PicocliCompleter
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>
aliasCommand
private CommandLine
cmd
private java.util.Set<java.lang.String>
commands
-
Constructor Summary
Constructors Constructor Description PicocliCommands(CommandLine cmd)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>
commandAliases()
org.jline.console.CmdDesc
commandDescription(java.lang.String command)
org.jline.console.CmdDesc
commandDescription(java.util.List<java.lang.String> args)
java.util.List<java.lang.String>
commandInfo(java.lang.String command)
java.util.Set<java.lang.String>
commandNames()
org.jline.reader.impl.completer.SystemCompleter
compileCompleters()
java.lang.Object
execute(org.jline.console.CommandRegistry.CommandSession session, java.lang.String command, java.lang.String[] args)
private CommandLine
findSubcommandLine(java.util.List<java.lang.String> args, int lastIdx)
private CommandLine
findSubcommandLine(CommandLine cmdline, java.lang.String command)
boolean
hasCommand(java.lang.String command)
java.lang.Object
invoke(org.jline.console.CommandRegistry.CommandSession session, java.lang.String command, java.lang.Object[] args)
-
-
-
Field Detail
-
cmd
private final CommandLine cmd
-
commands
private final java.util.Set<java.lang.String> commands
-
aliasCommand
private final java.util.Map<java.lang.String,java.lang.String> aliasCommand
-
-
Constructor Detail
-
PicocliCommands
public PicocliCommands(CommandLine cmd)
-
-
Method Detail
-
hasCommand
public boolean hasCommand(java.lang.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
-
findSubcommandLine
private CommandLine findSubcommandLine(java.util.List<java.lang.String> args, int lastIdx)
-
findSubcommandLine
private CommandLine findSubcommandLine(CommandLine cmdline, java.lang.String command)
-
commandDescription
public org.jline.console.CmdDesc commandDescription(java.util.List<java.lang.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 java.util.List<java.lang.String> commandInfo(java.lang.String command)
- Specified by:
commandInfo
in interfaceorg.jline.console.CommandRegistry
-
invoke
public java.lang.Object invoke(org.jline.console.CommandRegistry.CommandSession session, java.lang.String command, java.lang.Object[] args) throws java.lang.Exception
- Specified by:
invoke
in interfaceorg.jline.console.CommandRegistry
- Throws:
java.lang.Exception
-
execute
public java.lang.Object execute(org.jline.console.CommandRegistry.CommandSession session, java.lang.String command, java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
commandNames
public java.util.Set<java.lang.String> commandNames()
- Specified by:
commandNames
in interfaceorg.jline.console.CommandRegistry
-
commandAliases
public java.util.Map<java.lang.String,java.lang.String> commandAliases()
- Specified by:
commandAliases
in interfaceorg.jline.console.CommandRegistry
-
commandDescription
public org.jline.console.CmdDesc commandDescription(java.lang.String command)
-
-