17#ifndef __cmdline_option_h__
18#define __cmdline_option_h__
65 constexpr ArgFlags
None = 0;
66 constexpr ArgFlags Optional = 0x1;
67 constexpr ArgFlags AllowMultiple = 0x2;
111 Argument (
const char*
name =
nullptr, std::string description = std::string()) :
138 operator bool ()
const {
161 flags |= AllowMultiple;
167 assert (
type == Undefined);
174 assert (
type == Undefined);
181 assert (
type == Undefined);
189 assert (
type == Undefined);
199 assert (
type == Undefined);
207 const default_type max = std::numeric_limits<default_type>::infinity()) {
208 assert (
type == Undefined);
227 assert (
type == Undefined);
235 assert (
type == Undefined);
242 assert (
type == Undefined);
249 assert (
type == Undefined);
250 type = ArgDirectoryIn;
256 assert (
type == Undefined);
257 type = ArgDirectoryOut;
263 assert (
type == Undefined);
270 assert (
type == Undefined);
277 assert (
type == Undefined);
284 assert (
type == Undefined);
291 assert (
type == Undefined);
354 operator bool ()
const {
386 flags |= AllowMultiple;
390 bool is (
const std::string&
name)
const {
A class to specify a command-line argument.
std::string desc
the argument description
ArgType type
the argument type
Argument & type_file_out()
specifies that the argument should be an output file
std::string usage() const
Argument & type_bool()
specifies that the argument should be a boolean
Argument & type_image_in()
specifies that the argument should be an input image
Argument & allow_multiple()
specifies that multiple such arguments can be specified
Argument & type_float(const default_type min=-std::numeric_limits< default_type >::infinity(), const default_type max=std::numeric_limits< default_type >::infinity())
specifies that the argument should be a floating-point value
Argument & type_directory_in()
specifies that the argument should be an input directory
Argument & type_file_in()
specifies that the argument should be an input file
Argument & type_image_out()
specifies that the argument should be an output image
Argument & type_text()
specifies that the argument should be a text string
Argument & type_directory_out()
specifies that the argument should be an output directory
Argument & type_integer(const int64_t min=std::numeric_limits< int64_t >::min(), const int64_t max=std::numeric_limits< int64_t >::max())
specifies that the argument should be an integer
Argument & type_sequence_float()
specifies that the argument should be a sequence of comma-separated floating-point values.
union MR::App::Argument::@0 limits
a structure to store the various parameters of the Argument
Argument & type_sequence_int()
specifies that the argument should be a sequence of comma-separated integer values
struct MR::App::Argument::@0::@1 i
struct MR::App::Argument::@0::@2 f
ArgFlags flags
the argument flags (AllowMultiple & Optional)
Argument & optional()
specifies that the argument is optional
Argument & type_choice(const char *const *choices)
specifies that the argument should be selected from a predefined list
Argument & type_various()
specifies that the argument could be one of various types
Argument & type_tracks_out()
specifies that the argument should be an output tracks file
Argument(const char *name=nullptr, std::string description=std::string())
constructor
std::string syntax(int format) const
const char * id
the argument name
const char *const * choices
Argument & type_tracks_in()
specifies that the argument should be an input tracks file
a class to hold a named list of Option's
OptionGroup & operator+(const Option &option)
static std::string footer(int format)
OptionGroup(const char *group_name="OPTIONS")
std::string header(int format) const
std::string contents(int format) const
A class to specify a command-line option.
std::string usage() const
Option & allow_multiple()
specifies that multiple such options can be specified
std::string syntax(int format) const
Option & required()
specifies that the option is required
bool is(const std::string &name) const
Option(const char *name, const std::string &description)
ArgFlags flags
option flags (AllowMultiple and/or Optional)
const char * id
the option name
std::string desc
the option description
Option & operator+(const Argument &arg)
vector< ParsedArgument > argument
the list of arguments parsed from the command-line
vector< ParsedOption > option
the list of options parsed from the command-line
double default_type
the default type used throughout MRtrix