Package com.compomics.software.cli
Class CommandLineUtils
java.lang.Object
com.compomics.software.cli.CommandLineUtils
This class groups some convenience methods for the use of compomics tools in
command line.
- Author:
- Marc Vaudel
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringconcatenate(String[] args) Returns the list of arguments as space separated string for the command line.static Stringconcatenate(ArrayList<String> args) Returns the list of arguments as space separated string for the command line.static StringgetCommandLineArgument(File file) Returns the file as argument for the command line.static StringgetCommandLineArgument(ArrayList<File> files) Returns the list of file as argument for the command line.getDoubleListFromString(String aString, String separator) Parses a list of doubles from a command line option.Returns a list of files as imported from the command line option.getIntegerListFromString(String aString, String separator) Parses a list of integers from a command line option.static StringReturns the quote type to use.splitInput(String cliInput) Splits the input of comma separated command line input and returns the results as an arraylist.
-
Field Details
-
FORMATTER
The format to use for string output.- See Also:
-
SEPARATOR
The command line argument separator.- See Also:
-
-
Constructor Details
-
CommandLineUtils
public CommandLineUtils()
-
-
Method Details
-
getCommandLineArgument
Returns the list of file as argument for the command line.- Parameters:
files- the files- Returns:
- the list of file as string for command line argument
-
concatenate
Returns the list of arguments as space separated string for the command line.- Parameters:
args- the arguments- Returns:
- a comma separated string
-
concatenate
Returns the list of arguments as space separated string for the command line. Adds quotes where they seem to be needed.- Parameters:
args- the arguments- Returns:
- a comma separated string
-
getQuoteType
Returns the quote type to use. For example around file paths with spaces.- Returns:
- the quote type to use
-
getCommandLineArgument
Returns the file as argument for the command line.- Parameters:
file- the file- Returns:
- the list of file as string for command line argument
-
splitInput
Splits the input of comma separated command line input and returns the results as an arraylist.- Parameters:
cliInput- the CLI input- Returns:
- an arraylist containing the results, empty list if empty string
-
getFiles
public static ArrayList<File> getFiles(String optionInput, ArrayList<String> fileExtensions) throws FileNotFoundException Returns a list of files as imported from the command line option.- Parameters:
optionInput- the command line optionfileExtensions- the file extensions to be considered- Returns:
- a list of file candidates
- Throws:
FileNotFoundException- exception thrown whenever a file is not found
-
getIntegerListFromString
Parses a list of integers from a command line option.- Parameters:
aString- the command line optionseparator- the separator used to separate the string- Returns:
- the list if integers
-
getDoubleListFromString
Parses a list of doubles from a command line option.- Parameters:
aString- the command line optionseparator- the separator used to separate the string- Returns:
- the list if doubles
-