aboutsummaryrefslogtreecommitdiff
path: root/src/help.c
diff options
context:
space:
mode:
authordacctal <donotcontactmevia@email.invalid>2026-07-01 05:47:28 +0000
committerdacctal <donotcontactmevia@email.invalid>2026-07-01 05:47:28 +0000
commitfcfb6ac21651e286092bcc92309e89c8fa2e87fd (patch)
tree0f68c74e6dbc777769beb332f79323b4ecce3bd9 /src/help.c
parente328068fa24d61b3a171bac1ef915db90142bdcb (diff)
checkpoint!
Diffstat (limited to 'src/help.c')
-rw-r--r--src/help.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/help.c b/src/help.c
new file mode 100644
index 0000000..9bd05a2
--- /dev/null
+++ b/src/help.c
@@ -0,0 +1,79 @@
+/*
+
+ pkgit - package it!
+
+ Copyright (C) 2026 dacctal
+ 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 2 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 <https://www.gnu.org/licenses/>.
+
+*/
+
+#include <stdio.h>
+
+#include "help.h"
+
+#include "globs.h"
+
+void help(void) {
+ typedef struct {
+ const char *short_flag;
+ const char *long_flag;
+ const char *arg;
+ const char *desc;
+ } flag_t;
+
+ static const flag_t cmd_flags[] = {
+ {"-a", "--add", "[url]", "add a repo"},
+ {"-b", "--build", "[path]", "build a package"},
+ {"-d", "--declare", "", "install all packages"},
+ {"-s", "--search", "[pkgs]", "find a package from your repos"},
+ {"-i", "--install", "[pkgs, urls]", "install a package/repo"},
+ {"-r", "--remove", "[pkgs]", "remove an installed package"},
+ {"-l", "--list", "", "list all installed packages"},
+ {"-u", "--update", "", "update all installed packages"},
+ {"-h", "--help", "", "display this help message"},
+ {"-v", "--version", "", "display version number"},
+ {"-c", "--check", "", "run package checks"},
+ };
+
+ static const flag_t mod_flags[] = {
+ {"-q", "--quiet", "", "add a repo"},
+ {"-f", "--force", "", "build a package"},
+ };
+
+ if (is_verbose) {
+ printf(BOLD_MAGENTA " , \n");
+ printf(BOLD_MAGENTA " / \\ \n");
+ printf(BOLD_MAGENTA "_.--' '--._ \n");
+ printf(BOLD_MAGENTA "`'--, ,--'` " COLOR_RESET "pkgit " ITALIC GRAY "- package it!"COLOR_RESET"\n");
+ printf(BOLD_YELLOW " _- " BOLD_MAGENTA "\\ /" BOLD_YELLOW " -_ " MAGENTA VERSION COLOR_RESET "\n");
+ printf(BOLD_YELLOW "'-_ " BOLD_MAGENTA "'" BOLD_YELLOW " _-' \n");
+ printf(BOLD_YELLOW " `'-.-'` " COLOR_RESET "\n");
+ } else {
+ printf("pkgit %s%s- package it!%s\n", ITALIC, GRAY, COLOR_RESET);
+ printf("%s%s%s\n", MAGENTA, VERSION, COLOR_RESET);
+ }
+ printf("\n");
+
+ printf(RED "subcommand flags" COLOR_RESET ":\n");
+ for (size_t i = 0; i < sizeof(cmd_flags)/sizeof(cmd_flags[0]); i++) {
+ printf(COLOR_RESET "\t" GREEN "%-2s" COLOR_RESET ", " YELLOW "%-12s" BLUE "%-16s" GRAY "# %s\n" COLOR_RESET,
+ cmd_flags[i].short_flag, cmd_flags[i].long_flag, cmd_flags[i].arg, cmd_flags[i].desc);
+ }
+
+ printf("\n" RED "modifier flags" COLOR_RESET ":\n");
+ for (size_t i = 0; i < sizeof(mod_flags)/sizeof(mod_flags[0]); i++) {
+ printf(COLOR_RESET "\t" GREEN "%-2s" COLOR_RESET ", " YELLOW "%-12s" BLUE "%-16s" GRAY "# %s\n" COLOR_RESET,
+ mod_flags[i].short_flag, mod_flags[i].long_flag, mod_flags[i].arg, mod_flags[i].desc);
+ }
+}