Classes | |
class | Argument |
A class to specify a command-line argument. More... | |
class | ArgumentList |
a class to hold the list of Argument's More... | |
class | Description |
vector of strings to hold more comprehensive command description More... | |
class | Example |
object for storing a single example command usage More... | |
class | ExampleList |
a class to hold the list of Example's More... | |
class | Option |
A class to specify a command-line option. More... | |
class | OptionGroup |
a class to hold a named list of Option's More... | |
class | OptionList |
a class to hold the list of option groups More... | |
class | ParsedArgument |
class | ParsedOption |
object storing information about option parsed from command-line More... | |
Functions | |
const char * | argtype_description (ArgType type) |
std::string | help_head (int format) |
std::string | help_synopsis (int format) |
std::string | help_tail (int format) |
std::string | usage_syntax (int format) |
void | check_overwrite (const std::string &name) |
void | init (int argc, const char *const *argv) |
initialise MRtrix and parse command-line arguments More... | |
void | verify_usage () |
verify that command's usage() function has set requisite fields [used internally] More... | |
void | parse_special_options () |
option parsing that should happen before GUI creation [used internally] More... | |
void | parse () |
do the actual parsing of the command-line [used internally] More... | |
void | sort_arguments (int argc, const char *const *argv) |
sort command-line tokens into arguments and options [used internally] More... | |
const Option * | match_option (const char *stub) |
uniquely match option stub to Option More... | |
std::string | full_usage () |
dump formatted help page [used internally] More... | |
const vector< ParsedOption > | get_options (const std::string &name) |
return all command-line options matching name More... | |
template<typename T > | |
T | get_option_value (const std::string &name, const T default_value) |
Returns the option value if set, and the default otherwise. More... | |
std::string | operator+ (const char *left, const App::ParsedArgument &right) |
convenience function provided mostly to ease writing Exception strings More... | |
std::ostream & | operator<< (std::ostream &stream, const App::ParsedArgument &arg) |
void | set_executable_uses_mrtrix_version () |
Variables | |
const char * | mrtrix_version |
const char * | build_date |
int | log_level |
int | exit_error_code |
std::string | NAME |
std::string | command_history_string |
bool | overwrite_files |
void(* | check_overwrite_files_func )(const std::string &name) |
bool | fail_on_warn |
bool | terminal_use_colour |
const std::thread::id | main_thread_ID |
int | argc |
const char *const * | argv |
const char * | project_version |
const char * | project_build_date |
vector< ParsedArgument > | argument |
the list of arguments parsed from the command-line More... | |
vector< ParsedOption > | option |
the list of options parsed from the command-line More... | |
Description | DESCRIPTION |
additional description of the command over and above the synopsis More... | |
ExampleList | EXAMPLES |
example usages of the command More... | |
ArgumentList | ARGUMENTS |
the arguments expected by the command More... | |
OptionList | OPTIONS |
the options accepted by the command More... | |
bool | REQUIRES_AT_LEAST_ONE_ARGUMENT |
set to false if command can operate with no arguments More... | |
const char * | AUTHOR |
set the author of the command More... | |
const char * | COPYRIGHT |
set the copyright notice if different from that used in MRtrix More... | |
const char * | SYNOPSIS |
set a one-sentence synopsis for the command More... | |
Description | REFERENCES |
add references to command help page More... | |
OptionGroup | __standard_options |
the group of standard options for all commands More... | |
const char * MR::App::argtype_description | ( | ArgType | type | ) |
|
inline |
std::string MR::App::full_usage | ( | ) |
dump formatted help page [used internally]
|
inline |
Returns the option value if set, and the default otherwise.
Returns the value of (the first occurence of) option name
or the default value provided as second argument.
Use:
const vector< ParsedOption > MR::App::get_options | ( | const std::string & | name | ) |
return all command-line options matching name
This returns a vector of vectors, where each top-level entry corresponds to a distinct instance of the option, and each entry within a top-level entry corresponds to a argument supplied to that option.
Individual options can be retrieved easily using the as_* methods, or implicit type-casting. Any relevant range checks are performed at this point, based on the original App::Option specification. For example:
std::string MR::App::help_head | ( | int | format | ) |
std::string MR::App::help_synopsis | ( | int | format | ) |
std::string MR::App::help_tail | ( | int | format | ) |
void MR::App::init | ( | int | argc, |
const char *const * | argv | ||
) |
initialise MRtrix and parse command-line arguments
this function must be called from within main(), immediately after the argument and options have been specified, and before any further processing takes place.
|
inline |
|
inline |
void MR::App::parse | ( | ) |
do the actual parsing of the command-line [used internally]
void MR::App::parse_special_options | ( | ) |
option parsing that should happen before GUI creation [used internally]
void MR::App::set_executable_uses_mrtrix_version | ( | ) |
void MR::App::sort_arguments | ( | int | argc, |
const char *const * | argv | ||
) |
sort command-line tokens into arguments and options [used internally]
std::string MR::App::usage_syntax | ( | int | format | ) |
void MR::App::verify_usage | ( | ) |
verify that command's usage() function has set requisite fields [used internally]
|
extern |
the group of standard options for all commands
|
extern |
|
extern |
the list of arguments parsed from the command-line
|
extern |
the arguments expected by the command
This is designed to be used within each command's usage() function. Add argument and their description using the Argument class and the'+' operator, e.g.:
|
extern |
|
extern |
set the author of the command
|
extern |
|
extern |
|
extern |
|
extern |
set the copyright notice if different from that used in MRtrix
|
extern |
additional description of the command over and above the synopsis
This is designed to be used within each command's usage() function. Add a paragraph to the description using the '+' operator, e.g.:
|
extern |
example usages of the command
This is designed to be used within each command's usage() function. Add various examples in order to demonstrate the different syntaxes and/or capabilities of the command, e.g.:
|
extern |
Definition at line 35 of file exception.h.
|
extern |
|
extern |
Definition at line 34 of file exception.h.
|
extern |
|
extern |
|
extern |
the list of options parsed from the command-line
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
add references to command help page
Like the description, use the '+' operator to add paragraphs (typically one citation per paragraph)."
|
extern |
set to false if command can operate with no arguments
By default, the help page is shown command is invoked without arguments. Some commands (e.g. MRView) can operate without arguments.
|
extern |
set a one-sentence synopsis for the command
|
extern |