Class
ArgumentParser
Stores multiple ArgParseOption objects and parses the command line arguments for these options.
ArgumentParser
Include Headers
seqan/arg_parse.h
Remarks
See the documentation of ToolDoc on how to format text. Where possible, formatting is added automatically for you. You have to use formatting in the following places: (1) usage lines, (2) option help texts, (3) description and additional text sections.
Member Functions
ArgumentParserConstructor
Functions
addArgumentAdds a ArgParseArgument object to the ArgumentParser.
addDefaultValueAdds/appends a new value to the list of default values.
addDescriptionAppends a description paragraph to the ArgumentParser documentation.
addLineAdds a line of text to the help output of the ArgumentParser in the block of ArgParseOptions.
addListItemAdd list item to ToolDoc object. Appends a list item to the ArgumentParser.
addOptionAdds a ArgParseOption object to the ArgumentParser.
addSectionAdd section to ToolDoc object. Begins a new section of ArgParseOption the help output of the ArgumentParser.
addTextAdd text line/paragraph to ToolDoc. Appends a text paragraph to the ArgumentParser.
addTextSectionAdds a text section to the ArgumentParser.
addTextSubSectionAdds a text subsection to the ArgumentParser.
addUsageLineAdds a line of text to the usage output of the ArgumentParser.
getAppNameGet tool name of ArgumentParser object.
getArgumentReturns a reference to the specified argument.
getArgumentValueReturns the value of the ArgParseArgument object. If the ArgParseArgument is a list or can hold multiple values (numberOfArguments) you can specify which value you want to get. If not set the first value will be returned. Retrieves the value of an argument given by its position.
getArgumentValueCountReturns the number of values stored in the specified option.
getArgumentValuesReturns all values of the ArgParseArgument object as const std::vector. Returns all values of an option given on the command line.
getCategoryGet tool category of ToolDoc object. Get tool category of ArgumentParser object.
getOptionReturns a reference to the specified option.
getOptionValueRetrieves the value of an option given either the short or long name.
getOptionValueCountReturns the number of values stored in the specified option.
getOptionValuesReturns all values of an option given on the command line.
getShortDescriptionGet short description of ToolDoc object. Gets short description of ArgumentParser.
getVersionGet version string from ToolDoc object. Get version string from ArgumentParser object.
hasDefaultReturns true if a default value was given for that argument. Returns whether an option has a default value or not.
hasOptionReturns whether a certain option is registered in the parser.
hideOptionHides the ArgParseOption from the help screen. Hides the ArgParseOption defined by the parameter name (which can be either the short or the long name) from the help screen.
isSetReturns true if a value was assigned to the argument. Returns whether an option was set on the parsed command line.
parseParses the command line.
printHelpPrints the complete help message for the parser to a stream.
printShortHelpPrints a short help message for the parser to a stream
printVersionPrints the version information of the parser to a stream.
setAppNameSets application name of ArgumentParser.
setCategorySet tool category for ToolDoc object. Set tool category for ArgumentParser object.
setDateSet date string for ToolDoc object. Sets date string of ArgumentParser.
setDefaultValueSets the default value for the given option.
setMaxValueSets the maximum value of a ArgParseArgument object.
setMinValueSets the minimum value of a ArgParseArgument object.
setRequiredSets whether or not the option is mandatory. Sets whether or not the option defined by the parameter name (which can be either the short or the long name) is mandatory.
setShortDescriptionSet short description for ToolDoc object. Sets short description of the ArgumentParser object.
setValidValuesSets the set of allowed values of a ArgParseArgument object.
setVersionSet version string for ToolDoc object. Sets version string of ArgumentParser.
writeCTDExports the app's interface description to a .ctd file.
Examples
The following gives a simple example of how to use the ArgumentParser.
ArgumentParser parser("alf");
setShortDescription(parser, "Alignment free sequence comparison");
setVersion(parser, "1.0");
setDate(parser, "Jan 2010");
 
addUsageLine(parser, "[\fIOPTIONS\fP] \fB-i\fP \fIIN\fP \fB-o\fP \fIOUT\fP");
 
addDescription(parser,
               "ALF can be used to calculate the pairwise similarity of sequences "
               "using alignment-free methods. All methods which are implemented are "
               "based on k-mer counts.");
 
addOption(parser, ArgParseOption("i", "inputFile", "Name of the multi-FASTA input.",
                                 ArgParseArgument(ArgParseArgument::INPUTFILE, "IN")));
setRequired(parser, "i");
 
addOption(parser, ArgParseOption("o", "outputFile", "Name of the multi-FASTA input.",
                                 ArgParseArgument(ArgParseArgument::OUTPUTFILE, "OUT")));
setRequired(parser, "o");
 
addTextSection(parser, "See Also");
addText(parser, "http://www.seqan.de/projects/alf");
SeqAn - Sequence Analysis Library - www.seqan.de
 

Page built @2012/10/02 11:10:28