org.crsh.shell.impl.command.spi
Class Command<T>

java.lang.Object
  extended by org.crsh.shell.impl.command.spi.Command<T>
Direct Known Subclasses:
ClassShellCommand, GroovyScriptShellCommand

public abstract class Command<T>
extends Object

A command as seen by the shell.


Constructor Summary
Command()
           
 
Method Summary
 CompletionMatch complete(RuntimeContext context, String line)
          Provide completions for the specified arguments.
 String describe(InvocationMatch<T> match, Format format)
           
 String describe(String line, Format format)
          Returns a description of the command or null if none can be found.
protected abstract  Completer getCompleter(RuntimeContext context)
          Returns a completer for this command.
abstract  CommandDescriptor<T> getDescriptor()
          Returns the command descriptor.
protected abstract  CommandMatch<?,?> resolve(InvocationMatch<T> match)
          Resolve the real match for a specified invocation match.
 CommandMatch<?,?> resolveCommand(Map<String,?> options, String subordinate, Map<String,?> subordinateOptions, List<?> arguments)
          Provides an invoker for the command line specified in a detyped manner.
 CommandMatch<?,?> resolveCommand(String line)
           
 CommandInvoker<?,?> resolveInvoker(String line)
          Provides an invoker for the command line specified as a command line to parse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command()
Method Detail

getDescriptor

public abstract CommandDescriptor<T> getDescriptor()
Returns the command descriptor.

Returns:
the descriptor

getCompleter

protected abstract Completer getCompleter(RuntimeContext context)
                                   throws CommandException
Returns a completer for this command.

Parameters:
context - the related runtime context
Returns:
the completer
Throws:
CommandException - anything that would prevent completion to happen

resolve

protected abstract CommandMatch<?,?> resolve(InvocationMatch<T> match)
Resolve the real match for a specified invocation match.

Parameters:
match - the match
Returns:
the command

describe

public final String describe(InvocationMatch<T> match,
                             Format format)

complete

public final CompletionMatch complete(RuntimeContext context,
                                      String line)
                               throws CommandException
Provide completions for the specified arguments.

Parameters:
context - the command context
line - the original command line arguments
Returns:
the completions
Throws:
CommandException

describe

public final String describe(String line,
                             Format format)
                      throws CommandException
Returns a description of the command or null if none can be found.

Parameters:
line - the usage line
format - the description format
Returns:
the description
Throws:
CommandException

resolveInvoker

public final CommandInvoker<?,?> resolveInvoker(String line)
                                         throws CommandException
Provides an invoker for the command line specified as a command line to parse.

Parameters:
line - the command line arguments
Returns:
the command
Throws:
CommandException

resolveCommand

public final CommandMatch<?,?> resolveCommand(String line)
                                       throws CommandException
Throws:
CommandException

resolveCommand

public final CommandMatch<?,?> resolveCommand(Map<String,?> options,
                                              String subordinate,
                                              Map<String,?> subordinateOptions,
                                              List<?> arguments)
                                       throws CommandException
Provides an invoker for the command line specified in a detyped manner.

Parameters:
options - the base options
subordinate - the subordinate command name, might null
subordinateOptions - the subordinate options
arguments - arguments
Returns:
the command
Throws:
CommandException


Copyright © 2015 eXo Platform SAS. All Rights Reserved.