34 #ifndef GRPC_SUPPORT_CMDLINE_H
35 #define GRPC_SUPPORT_CMDLINE_H
77 const char *help,
int *value);
80 const char *help,
int *value);
83 const char *help,
char **value);
86 gpr_cmdline *cl,
const char *name,
const char *help,
87 void (*on_extra_arg)(
void *user_data,
const char *arg),
void *user_data);
struct gpr_cmdline gpr_cmdline
Simple command line parser.
Definition: cmdline.h:69
GPRAPI char * gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0)
Get a string describing usage.
GPRAPI int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv)
Parse the command line; returns 1 on success, on failure either dies (by default) or returns 0 if gpr...
GPRAPI void gpr_cmdline_destroy(gpr_cmdline *cl)
Destroy the parser.
GPRAPI gpr_cmdline * gpr_cmdline_create(const char *description)
Construct a command line parser: takes a short description of the tool doing the parsing.
GPRAPI void gpr_cmdline_add_int(gpr_cmdline *cl, const char *name, const char *help, int *value)
Add an integer parameter, with a name (used on the command line) and some helpful text (used in the c...
GPRAPI void gpr_cmdline_on_extra_arg(gpr_cmdline *cl, const char *name, const char *help, void(*on_extra_arg)(void *user_data, const char *arg), void *user_data)
Set a callback for non-named arguments.
GPRAPI void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name, const char *help, int *value)
The same, for a boolean flag.
GPRAPI void gpr_cmdline_set_survive_failure(gpr_cmdline *cl)
Enable surviving failure: default behavior is to exit the process.
GPRAPI void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name, const char *help, char **value)
And for a string.