Class IConsoleCommand

java.lang.Object
com.biglybt.ui.console.commands.IConsoleCommand
Direct Known Subclasses:
Archive, Config, ConsoleInput.CommandEcho, ConsoleInput.CommandHelp, ConsoleInput.CommandLogging, ConsoleInput.CommandLogout, ConsoleInput.CommandQuit, ConsoleInput.CommandUI, Create, Move, OptionsConsoleCommand, Pairing, Plugin, RunState, Set, Share, Show, Subscriptions, Tags, TorrentCommand, UserCommand, UserCommand.ListUsersCommand, XML

public abstract class IConsoleCommand extends Object
base interface for all console commands
  • Field Details

    • main_name

      private String main_name
    • short_name

      private String short_name
    • commands

      private HashSet commands
  • Constructor Details

    • IConsoleCommand

      public IConsoleCommand(String main_name)
    • IConsoleCommand

      public IConsoleCommand(String main_name, String short_name)
  • Method Details

    • execute

      public abstract void execute(String commandName, ConsoleInput console, List<String> arguments)
      execute the command with the specified name using the specified arguments
      Parameters:
      commandName -
      console -
      arguments -
    • getCommandDescriptions

      public abstract String getCommandDescriptions()
      return high-level help about the commands supported by this object.
      Returns:
    • printHelp

      public final void printHelp(PrintStream out, List<String> args)
      do nothing by default
      Parameters:
      out -
      args -
    • printHelpExtra

      public void printHelpExtra(PrintStream out, List<String> args)
    • printHelp

      protected final void printHelp(PrintStream out, String arg)
      helper method if subclasses want to print out help for a particular subcommand
      Parameters:
      out -
      arg -
    • getCommandNames

      public Set getCommandNames()
      returns the set of command names that this command understands. eg: the 'quit' command might understand 'quit', 'q', 'bye' other commands might actually have several command names and execute different code depending upon the command name
      Returns:
    • getCommandName

      public final String getCommandName()
    • getShortCommandName

      public final String getShortCommandName()
    • getTorrentSummary

      protected String getTorrentSummary(DownloadManager dm)
      returns the summary details for the specified torrent. - we do this by obtaining the summary format and then performing variable substitution NOTE: we currently reprocess the summary format string each time however we could pre-parse this once.. its probably not that important though.
      Returns:
    • expandVariable

      protected String expandVariable(char variable, DownloadManager dm)
      expands the specified variable character into a string.
      currently available variables that can be expanded are:

      %a for state
      %c percentage complete
      %t torrent details - error message if error, otherwise torrent name
      %z size
      %e ETA
      %r progress, if we have disabled some files
      %d download speed
      %u upload speed
      %D amount downloaded
      %U amount uploaded
      %v upload slots %s connected seeds
      %p connected peers
      %S tracker seeds
      %P tracker peers
      Parameters:
      variable - variable character, eg: 'e' for ETA
      dm - download manager object
      Returns:
      string expansion of the variable
    • getDefaultSummaryFormat

      protected String getDefaultSummaryFormat()
      returns the format string (in printf style format) to use for displaying the torrent summary
      Returns:
    • getShortStateString

      private static String getShortStateString(int dmstate, boolean forced)
      returns a string representation of the specified state number suitable for inclusion in a torrent summary
      Parameters:
      dmstate -
      Returns: