Package revxrsal.commands.cli
Interface ConsoleCommandHandler
- All Superinterfaces:
AutoCloseable
,CommandHandler
- All Known Implementing Classes:
CLIHandler
A
CommandHandler
adapted for use in command-line applications-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ConsoleCommandHandler
create()
Creates aConsoleCommandHandler
that takes input and sends output to theSystem
's default streams.static @NotNull ConsoleCommandHandler
create
(@NotNull InputStream inputStream) Creates aConsoleCommandHandler
that takes input from the given input stream and sends output to theSystem
's default output streams.static @NotNull ConsoleCommandHandler
create
(@NotNull InputStream inputStream, @NotNull PrintStream outputStream) Creates aConsoleCommandHandler
that takes input from the given input stream and sends all output to the given output streamstatic @NotNull ConsoleCommandHandler
create
(@NotNull InputStream inputStream, @NotNull PrintStream outputStream, @NotNull PrintStream errorStream) Creates aConsoleCommandHandler
that takes input from the given input stream and sends each input to the specified stream@NotNull ConsoleActor
Returns the singletonConsoleActor
used by this console handlervoid
Polls the command-line for input.Methods inherited from interface java.lang.AutoCloseable
close
Methods inherited from interface revxrsal.commands.CommandHandler
accept, disableStackTraceSanitizing, dispatch, dispatch, failOnTooManyArguments, getArgumentParser, getAutoCompleter, getCategories, getCategory, getCommand, getCommands, getDependency, getDependency, getExceptionHandler, getFlagPrefix, getHelpWriter, getLocale, getMessagePrefix, getMethodCallerFactory, getRootPaths, getSwitchPrefix, getTranslator, parseArguments, parseArgumentsForCompletion, register, registerAnnotationReplacer, registerCondition, registerContextResolver, registerContextResolver, registerContextResolverFactory, registerContextResolverFactory, registerContextValue, registerContextValue, registerDependency, registerDependency, registerExceptionHandler, registerParameterValidator, registerPermissionReader, registerResponseHandler, registerSenderResolver, registerValueResolver, registerValueResolver, registerValueResolverFactory, registerValueResolverFactory, setArgumentParser, setExceptionHandler, setFlagPrefix, setHelpWriter, setLocale, setMessagePrefix, setMethodCallerFactory, setSwitchPrefix, unregister, unregister, unregisterAllCommands
-
Method Details
-
getConsole
Returns the singletonConsoleActor
used by this console handler- Returns:
- The console actor
-
pollInput
void pollInput()Polls the command-line for input. This should only be called after everything has been registered! -
create
Creates aConsoleCommandHandler
that takes input and sends output to theSystem
's default streams.- Returns:
- The newly created console command handler
-
create
Creates aConsoleCommandHandler
that takes input from the given input stream and sends output to theSystem
's default output streams.- Parameters:
inputStream
- Input stream to poll input from- Returns:
- The newly created console command handler
-
create
@NotNull static @NotNull ConsoleCommandHandler create(@NotNull @NotNull InputStream inputStream, @NotNull @NotNull PrintStream outputStream) Creates aConsoleCommandHandler
that takes input from the given input stream and sends all output to the given output stream- Parameters:
inputStream
- Input stream to poll input fromoutputStream
- Output stream to send normal messages to. This will also be used for errors.- Returns:
- The newly created console command handler
-
create
@NotNull static @NotNull ConsoleCommandHandler create(@NotNull @NotNull InputStream inputStream, @NotNull @NotNull PrintStream outputStream, @NotNull @NotNull PrintStream errorStream) Creates aConsoleCommandHandler
that takes input from the given input stream and sends each input to the specified stream- Parameters:
inputStream
- Input stream to poll input fromoutputStream
- Output stream to send normal messages to.errorStream
- Output stream to send error messages to.- Returns:
- The newly created console command handler
-