Package org.pentaho.di.pan
Class CommandLineOption
- java.lang.Object
-
- org.pentaho.di.pan.CommandLineOption
-
public class CommandLineOption extends Object
This class allows you to define command-line options.- Author:
- Matt Casters
-
-
Constructor Summary
Constructors Constructor Description CommandLineOption(String option)
Creates a new normal command line option without a descriptionCommandLineOption(String option, String description, StringBuilder argument)
Creates a new normal command line optionCommandLineOption(String option, String description, StringBuilder argument, boolean yesNo, boolean hiddenOption)
Creates a new command line option.CommandLineOption(String option, String description, StringBuilder argument, boolean yesNo, boolean hiddenOption, boolean extraParameter)
Creates a new command line option.CommandLineOption(String option, String description, org.pentaho.di.core.parameters.NamedParams argument, boolean hiddenOption)
Creates a new "array" command line option.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
extractAndSetArgument(String arg)
Gets the value of a commandline optionStringBuilder
getArgument()
String
getDescription()
String
getOption()
String
getUsageDescription()
boolean
isExtraParameter()
boolean
isHiddenOption()
boolean
isYesNo()
static boolean
parseArguments(List<String> args, CommandLineOption[] options, org.pentaho.di.core.logging.LogChannelInterface log)
Parse and set the command line arguments using the defined options.static void
printUsage(CommandLineOption[] options)
Print the usage of an application using the command line options.void
setArgument(StringBuilder argument)
void
setDescription(String description)
void
setExtraParameter(boolean extraParameter)
void
setHiddenOption(boolean hiddenOption)
void
setOption(String option)
void
setYesNo(boolean yesNo)
-
-
-
Constructor Detail
-
CommandLineOption
public CommandLineOption(String option, String description, StringBuilder argument, boolean yesNo, boolean hiddenOption)
Creates a new command line option.- Parameters:
option
- The option stringdescription
- the description of the optionargument
- the StringBuilder that will contain the argument lateryesNo
- true if this is a Yes/No flaghiddenOption
- true if this option should not be shown in the usage list.
-
CommandLineOption
public CommandLineOption(String option, String description, StringBuilder argument, boolean yesNo, boolean hiddenOption, boolean extraParameter)
Creates a new command line option.- Parameters:
option
- The option stringdescription
- the description of the optionargument
- the StringBuilder that will contain the argument lateryesNo
- true if this is a Yes/No flaghiddenOption
- true if this option should not be shown in the usage list.extraParameter
- true if this is an extra parameter after the regular options (filenames and so on)
-
CommandLineOption
public CommandLineOption(String option, String description, org.pentaho.di.core.parameters.NamedParams argument, boolean hiddenOption)
Creates a new "array" command line option.- Parameters:
option
- The option stringdescription
- the description of the optionargument
- the StringBuilder that will contain the argument laterhiddenOption
- true if this option should not be shown in the usage list.
-
CommandLineOption
public CommandLineOption(String option, String description, StringBuilder argument)
Creates a new normal command line option- Parameters:
option
- The option stringdescription
- the description of the optionargument
- the StringBuilder that will contain the argument later
-
CommandLineOption
public CommandLineOption(String option)
Creates a new normal command line option without a description- Parameters:
option
- The option string
-
-
Method Detail
-
getArgument
public StringBuilder getArgument()
- Returns:
- Returns the argument.
-
setArgument
public void setArgument(StringBuilder argument)
- Parameters:
argument
- The argument to set.
-
getOption
public String getOption()
- Returns:
- Returns the option.
-
setOption
public void setOption(String option)
- Parameters:
option
- The option to set.
-
isYesNo
public boolean isYesNo()
- Returns:
- Returns wether or not this is a Yes/No flag
-
setYesNo
public void setYesNo(boolean yesNo)
- Parameters:
yesNo
- sets wether or not this is a Yes/No flag
-
getDescription
public String getDescription()
- Returns:
- Returns the description.
-
setDescription
public void setDescription(String description)
- Parameters:
description
- The description to set.
-
getUsageDescription
public String getUsageDescription()
- Returns:
- the usage description
-
extractAndSetArgument
public String extractAndSetArgument(String arg)
Gets the value of a commandline option- Parameters:
arg
- The command line argument- Returns:
- The value of the commandline option specified.
-
isHiddenOption
public boolean isHiddenOption()
- Returns:
- Returns the hiddenOption.
-
setHiddenOption
public void setHiddenOption(boolean hiddenOption)
- Parameters:
hiddenOption
- The hiddenOption to set.
-
parseArguments
public static boolean parseArguments(List<String> args, CommandLineOption[] options, org.pentaho.di.core.logging.LogChannelInterface log)
Parse and set the command line arguments using the defined options.- Parameters:
args
- The list of arguments to parseoptions
- The command line options to use
-
isExtraParameter
public boolean isExtraParameter()
-
setExtraParameter
public void setExtraParameter(boolean extraParameter)
-
printUsage
public static void printUsage(CommandLineOption[] options)
Print the usage of an application using the command line options.- Parameters:
options
- the options to use
-
-