#############################################################################*/
#include <argp.h>
+#include <syslog.h>
#include <pakfire/ctx.h>
static const char* doc = "The Pakfire Build Service Client Tool";
+enum {
+ OPT_DEBUG = 1,
+};
+
+static struct argp_option options[] = {
+ { "debug", OPT_DEBUG, NULL, 0, "Run in debug mode", 0 },
+ { NULL },
+};
+
+static error_t parse(int key, char* arg, void* data) {
+ struct pakfire_ctx* ctx = data;
+
+ switch (key) {
+ case OPT_DEBUG:
+ pakfire_ctx_set_log_level(ctx, LOG_DEBUG);
+ break;
+
+ default:
+ return ARGP_ERR_UNKNOWN;
+ }
+
+ return 0;
+}
+
int main(int argc, char* argv[]) {
struct pakfire_ctx* ctx = NULL;
int r;
pakfire_ctx_set_progress_callback(ctx, cli_setup_progressbar, NULL);
// Parse the command line and run any commands
- r = cli_parse(NULL, commands, args_doc, doc, NULL, argc, argv, ctx);
+ r = cli_parse(options, commands, args_doc, doc, parse, argc, argv, ctx);
ERROR:
if (ctx)