|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.mucommander.command.Command
public class Command
Compiled shell commands.
A command is composed of three elements:
alias, used to identify the command through the application.command, which is what will be executed by the instance of Command.type, which can be any of system (invisible and inmutable),
invisible (invisible and mutable) or NORMAL_COMMAND (visible and mutable).
The basic command syntax is fairly simple:
\ character will escape the following character and be removed from the tokens." character will escape all characters until the next occurence of ", except for \." characters are not removed from the resulting tokens.
It's also possible to include keywords in a command:
$f is replaced by a file's full path.$n is replaced by a file's name.$e is replaced by a file's extension.$N is replaced by a file's name without its extension.$p is replaced by a file's parent's path.$j is replaced by the path of the folder in which the JVM was started.
Once a Command instance has been retrieved, execution tokens can be retrieved through the
getTokens(AbstractFile) method. This will return a tokenized version of the command and replace any
keyword by the corresponding file value . It's also possible to skip keyword replacement through the getTokens() method.
A command's executable tokens are typically meant to be used with ProcessRunner.execute(String[],AbstractFile)
in order to generate instances of AbstractProcess.
CommandManager,
ProcessRunner,
AbstractProcess| Field Summary | |
|---|---|
static int |
INVISIBLE_COMMAND
Describres invisible commands. |
static int |
NORMAL_COMMAND
Describes normal commands. |
static int |
SYSTEM_COMMAND
Describes system commands. |
| Constructor Summary | |
|---|---|
Command(java.lang.String alias,
java.lang.String command)
Creates a new command. |
|
Command(java.lang.String alias,
java.lang.String command,
int type)
Creates a new command. |
|
Command(java.lang.String alias,
java.lang.String command,
int type,
java.lang.String displayName)
Creates a new command. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object object)
|
java.lang.String |
getAlias()
Returns this command's alias. |
java.lang.String |
getCommand()
Returns the original, un-tokenised command. |
java.lang.String |
getDisplayName()
Returns the command's display name. |
java.lang.String[] |
getTokens()
Returns this command's tokens without performing keyword substitution. |
java.lang.String[] |
getTokens(AbstractFile file)
Returns this command's tokens, replacing keywords by the corresponding values from the specified file. |
java.lang.String[] |
getTokens(AbstractFile[] files)
Returns this command's tokens, replacing keywords by the corresponding values from the specified files. |
java.lang.String[] |
getTokens(FileSet files)
Returns this command's tokens, replacing keywords by the corresponding values from the specified fileset. |
static java.lang.String[] |
getTokens(java.lang.String command)
Returns the specified command's tokens without performing keyword substitution. |
static java.lang.String[] |
getTokens(java.lang.String command,
AbstractFile file)
Returns the specified command's tokens after replacing keywords by the corresponding values from the specified file. |
static java.lang.String[] |
getTokens(java.lang.String command,
AbstractFile[] files)
Returns the specified command's tokens after replacing keywords by the corresponding values from the specified files. |
static java.lang.String[] |
getTokens(java.lang.String command,
FileSet files)
Returns the specified command's tokens after replacing keywords by the corresponding values from the specified fileset. |
int |
getType()
Returns the command's type. |
int |
hashCode()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int NORMAL_COMMAND
public static final int SYSTEM_COMMAND
public static final int INVISIBLE_COMMAND
| Constructor Detail |
|---|
public Command(java.lang.String alias,
java.lang.String command,
int type,
java.lang.String displayName)
alias - alias of the command.command - command that will be executed.type - type of the command.displayName - name of the command as seen by users (if null, defaults to alias).
public Command(java.lang.String alias,
java.lang.String command)
This is a convenience constructor and is strictly equivalent to calling
.
Command(alias, command, NORMAL_COMMAND, null)
alias - alias of the command.command - command that will be executed.
public Command(java.lang.String alias,
java.lang.String command,
int type)
This is a convenience constructor and is strictly equivalent to calling
.
Command(alias, command, type, null)
alias - alias of the command.command - command that will be executed.type - type of the command.| Method Detail |
|---|
public java.lang.String[] getTokens()
public java.lang.String[] getTokens(AbstractFile file)
file - file from which to retrieve keyword substitution values.
public java.lang.String[] getTokens(FileSet files)
files - files from which to retrieve keyword substitution values.
public java.lang.String[] getTokens(AbstractFile[] files)
files - files from which to retrieve keyword substitution values.
public static java.lang.String[] getTokens(java.lang.String command)
command - command to tokenize.
public static java.lang.String[] getTokens(java.lang.String command,
AbstractFile file)
command - command to tokenize.file - file from which to retrieve keyword substitution values.
public static java.lang.String[] getTokens(java.lang.String command,
FileSet files)
command - command to tokenize.files - file from which to retrieve keyword substitution values.
public static java.lang.String[] getTokens(java.lang.String command,
AbstractFile[] files)
command - command to tokenize.files - file from which to retrieve keyword substitution values.
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic java.lang.String getCommand()
public java.lang.String getAlias()
public int getType()
public java.lang.String getDisplayName()
If it hasn't been set, returns this command's alias.
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard