static const char* doc = "The collecty client that can draw graphs";
typedef struct collecty_client_ctx {
+ enum {
+ // Enables debugging output
+ DEBUG = (1 << 0),
+ } flags;
+
// DBus
sd_bus* bus;
FILE* f;
} collecty_client_ctx;
+enum {
+ OPT_FORMAT = 1,
+};
+
+static struct argp_option options[] = {
+ { "format", OPT_FORMAT, "FORMAT", 0, "Output Format", 0 },
+ { NULL },
+};
+
static error_t parse(int key, char* arg, struct argp_state* state) {
collecty_client_ctx* ctx = state->input;
switch (key) {
+ case OPT_FORMAT:
+ ctx->format = arg;
+ break;
+
// Called for each argument
case ARGP_KEY_ARG:
// Take the graph name as first argument
int main(int argc, char* argv[]) {
struct argp parser = {
+ .options = options,
.parser = parse,
.doc = doc,
};