vg
tools for working with variation graphs
Loading...
Searching...
No Matches
vg::subcommand Namespace Reference

Classes

struct  ArgSpec
struct  BaseArgSpec
struct  BaseOptionGroup
struct  BaseValuation
struct  FlagArgSpec
struct  GroupedOptionGroup
struct  NegationFlagArgSpec
struct  OptionGroup
struct  Preset
struct  RangeArgSpec
class  Subcommand
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.

Enumerations

enum class  OptionFormat { SLUG , JSON , CLI }
 Represents a pringing format for options. More...
enum  CommandCategory {
  PIPELINE , TOOLKIT , WIDGET , DEVELOPMENT ,
  DEPRECATED
}

Functions

int get_option_id ()
 Get a new unique option ID.
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 ()
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 > ()
std::ostream & operator<< (std::ostream &out, const CommandCategory &category)
 Define a way to print the titles of the different categories.

Variables

const ValidatorFunction< double > double_is_positive
 Validate that a double is positive, or throw std::domain_error.
const ValidatorFunction< double > double_is_nonnegative
 Validate that a double is not negative, or throw std::domain_error.
const ValidatorFunction< double > double_is_fraction
 Validate that a double is a fraction between 0 and 1, inclusive, or throw std::domain_error.
const ValidatorFunction< size_t > size_t_is_nonzero
 Validate that a size_t is not zero, or throw std::domain_error.
const ValidatorFunction< size_t > size_t_is_positive
 Validate that a size_t is positive, or throw std::domain_error;.
const ValidatorFunction< int > int_is_nonnegative
 Validate that an int is not negative, or throw std::domain_error;.

Typedef Documentation

◆ ValidatorFunction

template<typename T>
using vg::subcommand::ValidatorFunction = 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.

◆ OptionFormat

enum class vg::subcommand::OptionFormat
strong

Represents a pringing format for options.

Enumerator
SLUG 
JSON 
CLI 

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 >() [1/2]

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

◆ get_metavar< bool >() [2/2]

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

◆ get_metavar< double >() [1/2]

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

◆ get_metavar< double >() [2/2]

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

◆ get_metavar< int >() [1/2]

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

◆ get_metavar< int >() [2/2]

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

◆ get_metavar< int8_t >() [1/2]

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

◆ get_metavar< int8_t >() [2/2]

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

◆ get_metavar< size_t >() [1/2]

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

◆ get_metavar< size_t >() [2/2]

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

◆ get_metavar< std::string >() [1/2]

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

◆ get_metavar< std::string >() [2/2]

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_fraction

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

Validate that a double is a fraction between 0 and 1, inclusive, or throw std::domain_error.

◆ 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.

◆ size_t_is_positive

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

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