vg
tools for working with variation graphs
Classes | Typedefs | Enumerations | Functions | Variables
vg::subcommand Namespace Reference

Classes

struct  ArgSpec
 
struct  BaseArgSpec
 
struct  BaseOptionGroup
 
struct  BaseValuation
 
struct  FlagArgSpec
 
struct  GroupedOptionGroup
 
struct  OptionGroup
 
struct  Preset
 
struct  RangeArgSpec
 
class  Subcommand
 
struct  TickChainLink
 
struct  Valuation
 
struct  ValueArgSpec
 

Typedefs

template<typename T >
using ValidatorFunction = std::function< void(const T &)>
 Function type used to validate arguments. Throw std::domain_error if not allowed, explaining why. More...
 

Enumerations

enum  CommandCategory {
  PIPELINE, TOOLKIT, WIDGET, DEVELOPMENT,
  DEPRECATED
}
 

Functions

int get_option_id ()
 Get a new unique option ID. More...
 
template<>
const char * get_metavar< size_t > ()
 
template<>
const char * get_metavar< int > ()
 
template<>
const char * get_metavar< int8_t > ()
 
template<>
const char * get_metavar< bool > ()
 
template<>
const char * get_metavar< double > ()
 
template<>
const char * get_metavar< std::string > ()
 
void print_table (const std::vector< std::pair< std::string, std::string >> &rows, ostream &out)
 
template<typename T >
const char * get_metavar ()
 
std::ostream & operator<< (std::ostream &out, const CommandCategory &category)
 Define a way to print the titles of the different categories. More...
 

Variables

const ValidatorFunction< double > double_is_positive
 Validate that a double is positive, or throw std::domain_error. More...
 
const ValidatorFunction< double > double_is_nonnegative
 Validate that a double is not negative, or throw std::domain_error. More...
 
const ValidatorFunction< size_t > size_t_is_nonzero
 Validate that a size_t is not zero, or throw std::domain_error. More...
 
const ValidatorFunction< int > int_is_nonnegative
 Validate that an int is not negative, or throw std::domain_error;. More...
 

Typedef Documentation

◆ ValidatorFunction

template<typename T >
using vg::subcommand::ValidatorFunction = typedef std::function<void(const T&)>

Function type used to validate arguments. Throw std::domain_error if not allowed, explaining why.

Enumeration Type Documentation

◆ CommandCategory

Defines what kind of command each subcommand is.

Enumerator
PIPELINE 

Some commands are part of the main build-graph, align, call variants pipeline.

TOOLKIT 

Some subcommands are important parts of the toolkit/swiss army knife for working with graphs and data.

WIDGET 

Some commands are less important but potentially useful widgets that let you do a thing you might need.

DEVELOPMENT 

Some commands are useful really only for developers.

DEPRECATED 

Some commands we're trying to move away from.

Function Documentation

◆ get_metavar()

template<typename T >
const char* vg::subcommand::get_metavar ( )

Get a string "metavar" placeholder for a command line option, appropriate to its type.

◆ get_metavar< bool >()

template<>
const char * vg::subcommand::get_metavar< bool > ( )

◆ get_metavar< double >()

template<>
const char * vg::subcommand::get_metavar< double > ( )

◆ get_metavar< int >()

template<>
const char * vg::subcommand::get_metavar< int > ( )

◆ get_metavar< int8_t >()

template<>
const char * vg::subcommand::get_metavar< int8_t > ( )

◆ get_metavar< size_t >()

template<>
const char * vg::subcommand::get_metavar< size_t > ( )

◆ get_metavar< std::string >()

template<>
const char * vg::subcommand::get_metavar< std::string > ( )

◆ get_option_id()

int vg::subcommand::get_option_id ( )

Get a new unique option ID.

◆ operator<<()

std::ostream & vg::subcommand::operator<< ( std::ostream &  out,
const CommandCategory category 
)

Define a way to print the titles of the different categories.

◆ print_table()

void vg::subcommand::print_table ( const std::vector< std::pair< std::string, std::string >> &  rows,
ostream &  out 
)

Print a table of rows, with each column starting at the same character on the line.

Prints the help from get_help() on an option parsing group in a nice way.

Variable Documentation

◆ double_is_nonnegative

const ValidatorFunction< double > vg::subcommand::double_is_nonnegative
Initial value:
= [](const double& d) {
if (d < 0) {
throw std::domain_error("cannot be negative");
}
}

Validate that a double is not negative, or throw std::domain_error.

◆ double_is_positive

const ValidatorFunction< double > vg::subcommand::double_is_positive
Initial value:
= [](const double& d) {
if (d <= 0) {
throw std::domain_error("must be strictly positive");
}
}

Validate that a double is positive, or throw std::domain_error.

◆ int_is_nonnegative

const ValidatorFunction< int > vg::subcommand::int_is_nonnegative
Initial value:
= [](const int& i) {
if (i < 0) {
throw std::domain_error("cannot be negative");
}
}

Validate that an int is not negative, or throw std::domain_error;.

◆ size_t_is_nonzero

const ValidatorFunction< size_t > vg::subcommand::size_t_is_nonzero
Initial value:
= [](const size_t& s) {
if (s == 0) {
throw std::domain_error("cannot be zero");
}
}

Validate that a size_t is not zero, or throw std::domain_error.