Package

grizzled

cmd

Permalink

package cmd

Classes and objects to aid in the construction of line-oriented command interpreters. This package is very similar, in concept, to the Python cmd module (though its implementation differs quite a bit).

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. cmd
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait BlockCommandHandler extends NoCompletionsHandler

    Permalink

    A block command is one that consists of multiple input lines between some sort of start and end indicator.

    A block command is one that consists of multiple input lines between some sort of start and end indicator. Mixing this trait into a command handler changes the behavior of the command reader when it see the command. Instead of calling moreInputNeeded() to determine when to stop reading, the command reader just keeps reading until it sees a line matching the EndCommand regular expression.

  2. sealed abstract class Command extends AnyRef

    Permalink

    Mapped commands.

  3. sealed abstract class CommandAction extends AnyRef

    Permalink

    Actions returned by handlers.

  4. trait CommandHandler extends AnyRef

    Permalink

    Trait for an object (or class) that handles a single command.

    Trait for an object (or class) that handles a single command. All logic for a given command is embodied in a single object that mixes in this trait.

  5. abstract class CommandInterpreter extends AnyRef

    Permalink

    Base class for command interpreters.

    Base class for command interpreters.

    CommandInterpreter is the base class of any command interpreter. This class and the CommandHandler trait provide a simple framework for writing line-oriented command-interpreters. This framework is conceptually similar to the Python cmd module and its Cmd class, though the implementation differs substantially in places.

    For reading input from the console, CommandInterpreter will use of any of the readline libraries supported by the grizzled.readline package. All of those libraries support a persistent command history, and most support command completion and command editing.

    A command line consists of an initial command name, followed by a list of arguments to that command. The CommandInterpreter class's command reader automatically separates the command and the remaining arguments, via the splitCommandAndArgs() method. Parsing the arguments is left to the actual command implementation. The rules for how the command is split from the remainder of the input line are outlined in the documentation for the splitCommandAndArgs() method.

  6. trait HiddenCommandHandler extends NoCompletionsHandler

    Permalink

    The handler trait for a hidden command.

    The handler trait for a hidden command. Hidden commands don't show up in the help or the history.

  7. class HistoryHandler extends CommandHandler

    Permalink

    Simple history command handler.

    Simple history command handler.

    A simple "history" (alias: "h") handler that displays the history to standard output. This history handler supports the following usage:

    history [n]

    Where n is the number of (most recent) history entries to show. If absent, n defaults to the size of the history buffer.

    This handler is not installed by default. It is provided as a convenience, for command interpreters to use if desired.

  8. case class KnownCommand(handler: CommandHandler, fullInputLine: String, name: String, args: String) extends Command with Product with Serializable

    Permalink
  9. trait NoCompletionsHandler extends CommandHandler

    Permalink

    Mixed in to indicate no completions are available.

  10. class RedoHandler extends CommandHandler

    Permalink

    Simple "redo command" handler.

    Simple "redo command" handler.

    A simple "redo" command handler that supports re-issuing a numbered command from the history or the last command with a given prefix. For example, it supports the following syntaxes:

    Input: !10, ! 10, or r 10 Meaning: Repeat the 10th command in the history. Input: `!ec`, `! ec`, or `r ec` Meaning: Repeat the most recent command whose name begins with "ec" Input: `!!`, `! !`, `r` Meaning: Repeat the last command. This handler is ''not'' installed by default. It is provided as a convenience, for command interpreters to use if desired.

  11. case class UnknownCommand(fullInputLine: String, name: String, args: String) extends Command with Product with Serializable

    Permalink

Value Members

  1. object CmdUtil

    Permalink

    Miscellaneous useful utility functions.

  2. object EOFCommand extends Command with Product with Serializable

    Permalink
  3. object EmptyCommand extends Command with Product with Serializable

    Permalink
  4. object KeepGoing extends CommandAction with Product with Serializable

    Permalink
  5. object Stop extends CommandAction with Product with Serializable

    Permalink
  6. def error(msg: String): Unit

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped