libgit2_d.example.args

Argument-processing helper structure

Members

Functions

ARGS_INFO_INIT
ARGS_INFO_INIT(int argc, char** argv)

< Did we see a -- separator

is_integer
int is_integer(int* out_, const(char)* str, int allow_negative)

Match an integer string, returning 1 if matched, 0 if not.

is_prefixed
size_t is_prefixed(const(char)* str, const(char)* pfx)

Check if a string has the given prefix. Returns 0 if not prefixed or the length of the prefix if it is.

match_arg_separator
int match_arg_separator(libgit2_d.example.args.args_info* args)

Check if we're processing past the single -- separator

match_bool_arg
int match_bool_arg(int* out_, libgit2_d.example.args.args_info* args, const(char)* opt)

Check current args entry against a "bool" opt (ie. --[no-]progress). If opt matches positively, out will be set to 1, or if opt matches negatively, out will be set to 0, and in both cases 1 will be returned. If neither the positive or the negative form of opt matched, out will be -1, and 0 will be returned.

match_int_arg
int match_int_arg(int* out_, libgit2_d.example.args.args_info* args, const(char)* opt, int allow_negative)

Check current args entry against opt string parsing as int. If opt matches exactly, take the next arg as an int value; if it matches as a prefix (equal sign optional), take the remainder of the arg as a int value; otherwise return 0.

match_str_arg
int match_str_arg(const(char)** out_, libgit2_d.example.args.args_info* args, const(char)* opt)

Check current args entry against opt string. If it matches exactly, take the next arg as a string; if it matches as a prefix with an equal sign, take the remainder as a string; otherwise return 0.

match_uint16_arg
int match_uint16_arg(ushort* out_, libgit2_d.example.args.args_info* args, const(char)* opt)

Check current args entry against opt string parsing as uint16. If opt matches exactly, take the next arg as a uint16_t value; if opt is a prefix (equal sign optional), take the remainder of the arg as a uint16_t value; otherwise return 0.

match_uint32_arg
int match_uint32_arg(uint* out_, libgit2_d.example.args.args_info* args, const(char)* opt)

Check current args entry against opt string parsing as uint32. If opt matches exactly, take the next arg as a uint16_t value; if opt is a prefix (equal sign optional), take the remainder of the arg as a uint32_t value; otherwise return 0.

optional_str_arg
int optional_str_arg(const(char)** out_, libgit2_d.example.args.args_info* args, const(char)* opt, const(char)* def)

Check current args entry against opt string. If it matches exactly, take the next arg as a string; if it matches as a prefix with an equal sign, take the remainder as a string; if value not supplied, default value def will be given. otherwise return 0.

strarray_from_args
void strarray_from_args(libgit2_d.strarray.git_strarray* array, libgit2_d.example.args.args_info* args)

Consume all remaining arguments in a git_strarray

Structs

args_info
struct args_info
Undocumented in source.

Meta