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
base interface for all console commands
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIConsoleCommand(String main_name) IConsoleCommand(String main_name, String short_name) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidexecute(String commandName, ConsoleInput console, List<String> arguments) execute the command with the specified name using the specified argumentsprotected StringexpandVariable(char variable, DownloadManager dm) expands the specified variable character into a string.abstract Stringreturn high-level help about the commands supported by this object.final Stringreturns the set of command names that this command understands.protected Stringreturns the format string (in printf style format) to use for displaying the torrent summaryfinal Stringprivate static StringgetShortStateString(int dmstate, boolean forced) returns a string representation of the specified state number suitable for inclusion in a torrent summaryprotected Stringreturns the summary details for the specified torrent.protected final voidprintHelp(PrintStream out, String arg) helper method if subclasses want to print out help for a particular subcommandfinal voidprintHelp(PrintStream out, List<String> args) do nothing by defaultvoidprintHelpExtra(PrintStream out, List<String> args)
-
Field Details
-
main_name
-
short_name
-
commands
-
-
Constructor Details
-
IConsoleCommand
-
IConsoleCommand
-
-
Method Details
-
execute
execute the command with the specified name using the specified arguments- Parameters:
commandName-console-arguments-
-
getCommandDescriptions
return high-level help about the commands supported by this object.- Returns:
-
printHelp
do nothing by default- Parameters:
out-args-
-
printHelpExtra
-
printHelp
helper method if subclasses want to print out help for a particular subcommand- Parameters:
out-arg-
-
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
-
getShortCommandName
-
getTorrentSummary
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
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 ETAdm- download manager object- Returns:
- string expansion of the variable
-
getDefaultSummaryFormat
returns the format string (in printf style format) to use for displaying the torrent summary- Returns:
-
getShortStateString
returns a string representation of the specified state number suitable for inclusion in a torrent summary- Parameters:
dmstate-- Returns:
-