Welcome to little lamb

Code » ssp » commit 3a4a2dc

Add command export

author Olivier Brunel
2023-04-22 11:42:44 UTC
committer Olivier Brunel
2023-04-25 15:02:08 UTC
parent 3232aaf39e48e7c2744839a338a18de8aad98df3

Add command export

Just an alias for "list --format"

src/ssp/commands.c +2 -0
src/ssp/export.c +21 -0

diff --git a/src/ssp/commands.c b/src/ssp/commands.c
index 78c3bd3..6dc18d4 100644
--- a/src/ssp/commands.c
+++ b/src/ssp/commands.c
@@ -5,6 +5,7 @@
 
 extern struct command command_add;
 extern struct command command_edit;
+extern struct command command_export;
 extern struct command command_import;
 extern struct command command_list;
 extern struct command command_remove;
@@ -14,6 +15,7 @@ extern struct command command_show;
 struct command *commands[] = {
     &command_add,
     &command_edit,
+    &command_export,
     &command_import,
     &command_list,
     &command_remove,
diff --git a/src/ssp/export.c b/src/ssp/export.c
new file mode 100644
index 0000000..5b43c71
--- /dev/null
+++ b/src/ssp/export.c
@@ -0,0 +1,21 @@
+/* This file is part of ssp                             https://lila.oss/ssp
+ * Copyright (C) 2023 Olivier Brunel                          jjk@jjacky.com */
+/* SPDX-License-Identifier: GPL-2.0-only */
+#include <errno.h>
+#include <limb/command.h>
+#include <limb/exitcode.h>
+#include <limb/output.h>
+#include "ssp.h"
+
+
+COMMAND(export, "Export entries", "[<pattern>]", NULL);
+
+int
+export_main(int argc, const char *argv[], const char *env[], const char usage[], void *ctx_)
+{
+    if (argc > 2)
+        diecmdusage(EX_USAGE, usage, &command_export);
+
+    const char *av[] = { NULL, "--format", argv[1] };
+    return run_command("list", 1 + argc, av, env, ctx_);
+}