]> git.ipfire.org Git - pakfire.git/commitdiff
cli: client: Implement some scaffolding for listing uploads
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 09:29:11 +0000 (09:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 09:29:11 +0000 (09:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/cli/lib/upload.c [new file with mode: 0644]
src/cli/lib/upload.h [new file with mode: 0644]
src/cli/lib/upload_list.c [new file with mode: 0644]
src/cli/lib/upload_list.h [new file with mode: 0644]
src/cli/pakfire-client.c

index 34d86759aadc9d298c00bb5ab777ab9ee0451626..78f414af713c7afb93a98692cf6cea923f68e9f2 100644 (file)
@@ -505,6 +505,10 @@ libcli_la_SOURCES = \
        src/cli/lib/transaction.h \
        src/cli/lib/update.c \
        src/cli/lib/update.h \
+       src/cli/lib/upload.c \
+       src/cli/lib/upload.h \
+       src/cli/lib/upload_list.c \
+       src/cli/lib/upload_list.h \
        src/cli/lib/version.c \
        src/cli/lib/version.h
 
diff --git a/src/cli/lib/upload.c b/src/cli/lib/upload.c
new file mode 100644 (file)
index 0000000..6ef733c
--- /dev/null
@@ -0,0 +1,35 @@
+/*#############################################################################
+#                                                                             #
+# Pakfire - The IPFire package management system                              #
+# Copyright (C) 2023 Pakfire development team                                 #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#include "command.h"
+#include "upload.h"
+#include "upload_list.h"
+
+static const char* args_doc =
+       "list";
+
+int cli_upload(void* data, int argc, char* argv[]) {
+       static const struct command commands[] = {
+               { "list", cli_upload_list, 0, 0, 0 },
+               { NULL },
+       };
+
+       return cli_parse(NULL, commands, args_doc, NULL, NULL, argc, argv, data);
+}
diff --git a/src/cli/lib/upload.h b/src/cli/lib/upload.h
new file mode 100644 (file)
index 0000000..1a99cab
--- /dev/null
@@ -0,0 +1,26 @@
+/*#############################################################################
+#                                                                             #
+# Pakfire - The IPFire package management system                              #
+# Copyright (C) 2023 Pakfire development team                                 #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#ifndef PAKFIRE_CLI_UPLOAD_H
+#define PAKFIRE_CLI_UPLOAD_H
+
+int cli_upload(void* data, int argc, char* argv[]);
+
+#endif /* PAKFIRE_CLI_UPLOAD_H */
diff --git a/src/cli/lib/upload_list.c b/src/cli/lib/upload_list.c
new file mode 100644 (file)
index 0000000..ffb3b22
--- /dev/null
@@ -0,0 +1,41 @@
+/*#############################################################################
+#                                                                             #
+# Pakfire - The IPFire package management system                              #
+# Copyright (C) 2023 Pakfire development team                                 #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#include <pakfire/ctx.h>
+
+#include "command.h"
+#include "upload_list.h"
+
+static const char* doc = "Lists all uploads";
+
+int cli_upload_list(void* data, int argc, char* argv[]) {
+       struct pakfire_ctx* ctx = data;
+       int r;
+
+       // Parse the command line
+       r = cli_parse(NULL, NULL, NULL, doc, NULL, argc, argv, NULL);
+       if (r)
+               goto ERROR;
+
+       // XXX TODO
+
+ERROR:
+       return r;
+}
diff --git a/src/cli/lib/upload_list.h b/src/cli/lib/upload_list.h
new file mode 100644 (file)
index 0000000..05aa7e5
--- /dev/null
@@ -0,0 +1,26 @@
+/*#############################################################################
+#                                                                             #
+# Pakfire - The IPFire package management system                              #
+# Copyright (C) 2023 Pakfire development team                                 #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#ifndef PAKFIRE_CLI_UPLOAD_LIST_H
+#define PAKFIRE_CLI_UPLOAD_LIST_H
+
+int cli_upload_list(void* data, int argc, char* argv[]);
+
+#endif /* PAKFIRE_CLI_UPLOAD_LIST_H */
index 594392d6f9427cc417b090ba0c7fd5e7cb2ac941..782f03c84fd6c3f0f014b6618c23d3cf1eb79b31 100644 (file)
 
 #include "lib/command.h"
 #include "lib/progressbar.h"
+#include "lib/upload.h"
 
 const char* argp_program_version = PACKAGE_VERSION;
 
 static const struct command commands[] = {
-       // No commands, yet
+       { "upload", cli_upload, -1, -1, 0 },
        { NULL },
 };
 
-static const char* args_doc = NULL;
+static const char* args_doc =
+       "upload ...";
 
 static const char* doc = "The Pakfire Build Service Client Tool";