gov.llnl.babel.cli
Interface CommandLineSwitch
- UserOptions.AssertionLevelSwitch, UserOptions.CCAModeSwitch, UserOptions.ClientSwitch, UserOptions.CommentLocalOnlySwitch, UserOptions.CxxIORExceptionSwitch, UserOptions.DefaultRepositoryPathSwitch, UserOptions.ExcludeExternalSwitch, UserOptions.ExcludeSwitch, UserOptions.GenerateHooksSwitch, UserOptions.GenerateSidlStdlibSwitch, UserOptions.GenerateSubdirOffSwitch, UserOptions.GenerateSubdirSwitch, UserOptions.HideGlueOffSwitch, UserOptions.HideGlueSwitch, UserOptions.IncludeReferencedSwitch, UserOptions.LanguageSubdirOffSwitch, UserOptions.LanguageSubdirSwitch, UserOptions.MakePrefixSwitch, UserOptions.MultiResetOption, UserOptions.MultiSwitch, UserOptions.NoDefaultRepositorySwitch, UserOptions.OutputDirectorySwitch, UserOptions.ParseCheckSwitch, UserOptions.ParseResolveOption, UserOptions.RenameSplicerSwitch, UserOptions.RepositoryPathSwitch, UserOptions.RequiredArgSwitch, UserOptions.ServerSwitch, UserOptions.ShortFileNamesSwitch, UserOptions.SuppressIORSwitch, UserOptions.SuppressStubSwitch, UserOptions.SuppressTimestampSwitch, UserOptions.TextSwitch, UserOptions.TimestampSwitch, UserOptions.TouchOption, UserOptions.VerboseSwitch, UserOptions.VersionSwitch, UserOptions.VpathSwitch
public interface CommandLineSwitch
Extensions implement this interface to add new command line switches to
Babel. Each command line switch has a separate instance.
String | getArgumentName() - If the switch has an argument, what name should be used
to identify it in the help text.
|
String | getHelpText() - Return a brief string describing what this command line switch
implies or does.
|
String | getLongName() - Return the long option name, usually one or more words separated by
hyphens.
|
int | getShortForm() - If the command line switch has a one character short form, return
the character value as an integer.
|
boolean | hasOptionalArgument() - Return
true if and only if, this command line switch
has an optional argument.
|
boolean | hasRequiredArgument() - Return
true if and only if, this command line switch
requires an argument.
|
boolean | isHidden() - Return
true if this command line option should be
hidden when the help text is generated.
|
void | processCommandSwitch(String optarg) - This method is called when the Babel end user specifies this command
line switch on the command line.
|
void | setShortForm(int value) - If the command line manager cannot support the short form you requested
or if you did not specify the short form, this method will be called
to set your short form.
|
getArgumentName
public String getArgumentName()
If the switch has an argument, what name should be used
to identify it in the help text. You may refer to this
name in getHelpText.
- null or the name of the optional or required argument.
getHelpText
public String getHelpText()
Return a brief string describing what this command line switch
implies or does. This text is presented when the user executes
the help command line option. Do not mention the short form,
if it's available, the automatically generated text will mention it.
- a non-null string with no newline characters.
getLongName
public String getLongName()
Return the long option name, usually one or more words separated by
hyphens. On the command line, users will invoke this option by
putting this string after two consecutive hyphen. For example, if this
method returned "foo-mode", users would invoke it by putting
"--foo-mode" on the command line. Try to avoid long names that are
likely to be used by other extensions.
- a non-null string containing one or more words separated by
hyphens. The string should not contain any white space characters.
getShortForm
public int getShortForm()
If the command line switch has a one character short form, return
the character value as an integer. Since there are fewer options for
the short form, do not count on it being available. If you do not
care to define a short form, return 0.
- 0 if you do not care to define a short form; otherwise, return
the short form character as an int. This value should be strictly
less than 65536. The return value should generally be a letter,
a digit, or punctuation character -- excluding 'W', '-', ':', and '?'.
hasOptionalArgument
public boolean hasOptionalArgument()
Return true
if and only if, this command line switch
has an optional argument. If this method returns true
,
hasRequiredArgument should return false
.
true
implies that the switch takes an optional
argument; false
implies that it does not.
hasRequiredArgument
public boolean hasRequiredArgument()
Return true
if and only if, this command line switch
requires an argument. If this method returns true
,
hasOptionalArgument should return false
.
true
implies that the switch take an optional
argument; false
implies that it does not.
isHidden
public boolean isHidden()
Return true
if this command line option should be
hidden when the help text is generated.
true
means that this options requests to not
be printed with the help text.
processCommandSwitch
public void processCommandSwitch(String optarg)
throws InvalidArgumentException,
InvalidOptionException,
CorruptSymbolException
This method is called when the Babel end user specifies this command
line switch on the command line.
optarg
- this argument will be null if the command line switch
doesn't take a required argument (i.e., hasRequiredArgument()
is false
) or if the command line switch takes an
optional argument (i.e., hasOptionalArgument()
is
true
) and an argument wasn't provided; otherwise, the
argument is a non-null string including the text from the command line.
InvalidArgumentException
- this indicates
that the command line argument provided is wrong somehow. For example,
if the argument should be an integer and the input isn't a valid
integer, throw this exception.InvalidOptionException
- this indicates
that the command line option itself is somehow wrong in the context of
preceeding switches. For example, two switches may be mutually
exclusive, so having both in a command line would cause the second
switch to throw this exception.
setShortForm
public void setShortForm(int value)
If the command line manager cannot support the short form you requested
or if you did not specify the short form, this method will be called
to set your short form. You must store the value provided by this call
and return it when
getShortForm()
is called in the future.
value
- your object must return this value in
future calls to getShortForm()
.