The base class for writing new commands. More...
#include <Command.hpp>
 
  
 | Public Member Functions | |
| int | operator() (int argc, char **argv) | 
| Runs the command and returns the error code; basically, your main() is supposed to directly delegate to this. | |
| void | help (std::ostream &out, bool html) | 
| Print help to out. | |
| const std::string & | getName () const | 
| Return the name of this command. | |
| const std::string & | getShortDescription () const | 
| Returns the short description of this command. | |
| std::string | getCommandLine () const | 
| Static Public Member Functions | |
| static std::string | formatDescription (const std::string &description, size_t indent, size_t maxLineLength, bool html) | 
| Formats description in the same way as is done for options descriptions (newline separates paragraphs, tab declares indentation on following lines of paragraph). | |
| static size_t | getHelpLineLength () | 
| Protected Member Functions | |
| Command (const std::string &name, const std::string &shortDescription, const std::string &formatVersionSupported, const std::string &longDescription) | |
| virtual | ~Command () | 
| Destructor can be customized, but it's preferred to complete all necessary cleanup in run() method. | |
| std::istream & | openStdin (const std::string &path) | 
| Returns stdin if path is "STDIN", otherwise returns the result of cgatools::util::InputStream::openCompressedInputStreamByExtension(). | |
| std::ostream & | openStdout (const std::string &path) | 
| Returns stdout if path is "STDOUT", otherwise returns the result of cgatools::util::OutputStream::openCompressedOutputStreamByExtension(). | |
| void | requireParam (const po::variables_map &vm, const std::string ¶m) | 
| Throws an exception if the given param was not specified on the command line. | |
| virtual int | run (po::variables_map &vm)=0 | 
| The actual code of the command goes here. | |
| Protected Attributes | |
| po::options_description | options_ | 
| po::positional_options_description | positionalOptions_ | 
The base class for writing new commands.
| static std::string cgatools::command::Command::formatDescription | ( | const std::string & | description, | |
| size_t | indent, | |||
| size_t | maxLineLength, | |||
| bool | html | |||
| ) |  [static] | 
Formats description in the same way as is done for options descriptions (newline separates paragraphs, tab declares indentation on following lines of paragraph).
| indent | The number of spaces to indent each line by. This is ignored when using boost 1.41 or before. | |
| lineLength | The maximum number of characters in a line. | |
| html | True to output html, false to output text. The html is assumed to be within a ... tag. | 
| std::istream& cgatools::command::Command::openStdin | ( | const std::string & | path | ) |  [protected] | 
Returns stdin if path is "STDIN", otherwise returns the result of cgatools::util::InputStream::openCompressedInputStreamByExtension().
| std::ostream& cgatools::command::Command::openStdout | ( | const std::string & | path | ) |  [protected] | 
Returns stdout if path is "STDOUT", otherwise returns the result of cgatools::util::OutputStream::openCompressedOutputStreamByExtension().
| void cgatools::command::Command::requireParam | ( | const po::variables_map & | vm, | |
| const std::string & | param | |||
| ) |  [protected] | 
Throws an exception if the given param was not specified on the command line.
| virtual int cgatools::command::Command::run | ( | po::variables_map & | vm | ) |  [protected, pure virtual] | 
The actual code of the command goes here.
Throw exceptions to communicate errors.
Implemented in cgatools::command::CallDiff, cgatools::command::Crr2Fasta, cgatools::command::DecodeCrr, cgatools::command::Evidence2Sam, cgatools::command::Fasta2Crr, cgatools::command::Join, cgatools::command::JunctionDiff, cgatools::command::ListCrr, cgatools::command::ListVariants, cgatools::command::Map2Sam, cgatools::command::SnpDiff, and cgatools::command::TestVariants.
 1.6.2
 1.6.2