aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2020-07-30 01:57:26 +0200
committerJan200101 <sentrycraft123@gmail.com>2020-07-30 01:57:26 +0200
commit8bdba8891071110fe3f04de81dbe375c9c1caa80 (patch)
treed29a9f4220e351a0f5dd5b4a028af9b76cc16203 /src/main.c
downloadpolecat-8bdba8891071110fe3f04de81dbe375c9c1caa80.tar.gz
polecat-8bdba8891071110fe3f04de81dbe375c9c1caa80.zip
Initial commit0.1.0
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..2e7655d
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <string.h>
+
+#include "main.h"
+#include "wine.h"
+#include "dxvk.h"
+#include "common.h"
+
+const static struct Command main_commands[] = {
+ { .name = "wine", .func = wine, .description = "manage wine versions" },
+ { .name = "dxvk", .func = dxvk, .description = "manage dxvk versions" },
+ { .name = "info", .func = main_info, .description = "show some information about polecat" },
+ { .name = "help", .func = main_help, .description = "displays this message" },
+};
+
+
+int main(int argc, char** argv)
+{
+ if (argc > 1)
+ {
+ for (int i = 0; i < ARRAY_LEN(main_commands); ++i)
+ {
+ if (!strcmp(main_commands[i].name, argv[1])) return main_commands[i].func(argc, argv);
+ }
+ }
+
+ return main_help(argc, argv);
+}
+
+int main_info(int argc, char** argv)
+{
+ printf("Version:\t\t%s\n"
+ "User-Agent:\t\t%s/%s\n",
+ VERSION,
+ NAME, VERSION);
+
+ return 0;
+}
+
+int main_help(int argc, char** argv)
+{
+ puts("usage: polecat <command>\n\nList of commands:");
+
+ print_help(main_commands, ARRAY_LEN(main_commands));
+
+ return 0;
+} \ No newline at end of file