From: Michael Tremer Date: Tue, 17 Oct 2023 09:29:11 +0000 (+0000) Subject: cli: client: Implement some scaffolding for listing uploads X-Git-Tag: 0.9.30~1469 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=125a95c92fe2d98b3b16bfeef02aa4a18fe97cbf;p=people%2Fms%2Fpakfire.git cli: client: Implement some scaffolding for listing uploads Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 34d86759a..78f414af7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 000000000..6ef733cf0 --- /dev/null +++ b/src/cli/lib/upload.c @@ -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 . # +# # +#############################################################################*/ + +#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 index 000000000..1a99cab57 --- /dev/null +++ b/src/cli/lib/upload.h @@ -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 . # +# # +#############################################################################*/ + +#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 index 000000000..ffb3b22f0 --- /dev/null +++ b/src/cli/lib/upload_list.c @@ -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 . # +# # +#############################################################################*/ + +#include + +#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 index 000000000..05aa7e575 --- /dev/null +++ b/src/cli/lib/upload_list.h @@ -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 . # +# # +#############################################################################*/ + +#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 */ diff --git a/src/cli/pakfire-client.c b/src/cli/pakfire-client.c index 594392d6f..782f03c84 100644 --- a/src/cli/pakfire-client.c +++ b/src/cli/pakfire-client.c @@ -24,15 +24,17 @@ #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";