the name of the base command line.
the ClassTag of SubCommand , usually inferred.
the TypeTag of SubCommand , usually inferred.
Error messages
Error messages
Similarity floor for when searching for similar sub-command names.
Similarity floor for when searching for similar sub-command names. *
Section separator
Section separator
The maximum line lengths for tool descriptions
The maximum line lengths for tool descriptions
Lengths for names and descriptions on the command line
Lengths for names and descriptions on the command line
Section headers
Section headers
The command line with all arguments and values stored after the parseSubCommand() or parseCommandAndSubCommand() was successful, otherwise None.
the name of the base command line.
the name of the base command line.
Formats the short description of a tool when printing out the list of sub-commands in the usage.
Formats the short description of a tool when printing out the list of sub-commands in the usage.
(1) find the first period (".") and keep only everything before it (2) shorten it to the maximum line length adding "..." to the end.
The name of "command" on the command line
The name of "command" on the command line
Method for parsing command arguments as well as a specific sub-command arguments.
Method for parsing command arguments as well as a specific sub-command arguments.
Typically, the arguments are the format [command arguments] [sub-command] [sub-command arguments]
. This in
contrast to parseSubCommand, which omits the [command arguments]
section.
(1) Searches for --
or a recognized SubCommand in the list of arguments to partition the main and clp arguments. The
SubCommands are found by searching for all classes that extend SubCommand.
(2) Parses the main arguments and creates an instance of main, and returns None if any error occurred.
(3) Executes the afterMainBuilding
of code after the main instance has been created.
(3) Parses the clp arguments and creates an instance of clp, and returns None if any error occurred.
(3) Executes the afterClpBuilding
of code after the clp instance has been created.
It creates CommandLineProgramParsers to parse the main class and clp arguments respectively.
the command line arguments to parse.
the set of available sub-commands
the Command and SubCommand instances initialized with the command line arguments, or None if unsuccessful.
The main method for parsing command line arguments.
The main method for parsing command line arguments. Typically, the arguments are the format
[clp Name] [clp arguments]
. This in contrast to parseCommandAndSubCommand, which includes arguments to the main class in
the [main arguments]
section.
(1) Finds all classes that extend SubCommand to include them as valid command line programs on the command line.
(2) When the first arg is one of the command line programs names (usually getSimpleName
), it creates a
CommandLineProgramParser (SubCommand parser) for the given command line program, and allows the SubCommand parser to
parse the rest of the args.
(3) Returns None
in the case of any parsing error, or an instance of the command line program constructed
according to the parsed arguments.
the command line arguments to parse.
the set of possible sub-command types/classes
true to print the version in the usage messages, false otherwise.
if true include help and version arguments
an optional string that will be printed prior to any usage message.
a clp instance initialized with the command line arguments, or None if unsuccessful.
A typical command line program will call this to get the beginning of the usage message, and then append a description of the program.
A typical command line program will call this to get the beginning of the usage message, and then append a description of the program.
A typical command line program will call this to get the beginning of the usage message, and then append a description of the program.
A typical command line program will call this to get the beginning of the usage message, and then append a description of the program.
Class for parsing the command line when we also have sub-commands.
We have two possible entry points: (1) parseSubCommand() for when we have set of sub-commands, each having their own set of arguments, and we use the first argument to get the class's simple name (
getSimpleName
), and pass the rest of the arguments to a properly instantiated CommandLineProgramParser to parse the arguments and build an instance of that class. (2) parseCommandAndSubCommand for the same case as (1), but when the main program itself also has arguments, which come prior to the name of the command line program.To route the arguments to build the appropriate program, the parser searches for a command line program that is a sub-class of SubCommand, and creates a CommandLineProgramParser to parse the args and return an instance of the SubCommand.
Constructor arguments for the sub-command classes or command class can be annotated with com.fulcrumgenomics.sopt.arg while constructors themselves can be annotated with clp. The latter may be omitted, but is extremely useful for grouping related sub-commands and having a common description.
the base class for all sub-commands to display and parse on the command line.