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 StringextractAndSetArgument(String arg)Gets the value of a commandline optionStringBuildergetArgument()StringgetDescription()StringgetOption()StringgetUsageDescription()booleanisExtraParameter()booleanisHiddenOption()booleanisYesNo()static booleanparseArguments(List<String> args, CommandLineOption[] options, org.pentaho.di.core.logging.LogChannelInterface log)Parse and set the command line arguments using the defined options.static voidprintUsage(CommandLineOption[] options)Print the usage of an application using the command line options.voidsetArgument(StringBuilder argument)voidsetDescription(String description)voidsetExtraParameter(boolean extraParameter)voidsetHiddenOption(boolean hiddenOption)voidsetOption(String option)voidsetYesNo(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
-
-