]> git.ayabusa.dev Git - thoryum.git/commitdiff
Error message
authorAyabusa <lebgpub@gmail.com>
Sun, 7 Jun 2026 19:01:54 +0000 (21:01 +0200)
committerAyabusa <lebgpub@gmail.com>
Sun, 7 Jun 2026 19:01:54 +0000 (21:01 +0200)
Makefile
src/cli.c [new file with mode: 0644]
src/cli.h [new file with mode: 0644]
src/cli.o [new file with mode: 0644]
src/main.c

index ee48c6d22085e7332fa74d51945e9c87ad860b8d..262a9eb82d965f2d2dceb8c57bf187998482ab4d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 CFLAGS = -Wall -Wextra -g
 LIBS = -lcurl
-SRC = src/main.c src/cpu.c src/downloader.c
-OBJ = build/main.o build/cpu.o build/downloader.o
+SRC = src/main.c src/cpu.c src/downloader.c src/cli.c
+OBJ = build/main.o build/cpu.o build/downloader.o src/cli.o
 RES = build/Thoryum
 
 all: setup $(OBJ) build
@@ -16,10 +16,13 @@ build/cpu.o: src/cpu.c
 build/downloader.o: src/downloader.c
        $(CC) $(CFLAGS) -c $^ -o $@ $(LIBS)
 
+build/cli.o: src/cli.c
+       $(CC) $(CFLAGS) -c $^ -o $@ $(LIBS)
+
 setup:
        mkdir -p build
 
-run: 
+run:
        ./$(RES)
 
 debug:
diff --git a/src/cli.c b/src/cli.c
new file mode 100644 (file)
index 0000000..56b8552
--- /dev/null
+++ b/src/cli.c
@@ -0,0 +1,32 @@
+#include "cli.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+struct ctx *init_ctx(int argc, char **argv) {
+    struct ctx *ctx = malloc(sizeof(struct ctx));
+
+}
+
+void print_help() {
+    printf(
+    "Usage: thoryum [options]\n"
+    "Thoryum is an install helper, and update wrapper for the Thorium browser.\n"
+    "\n"
+    "Options:\n"
+    "  -h, --help\n"
+    "      Print this help message.\n"
+    "\n"
+    "  -l, --location <path>\n"
+    "      Install Thorium to a specific path, default is '/usr/bin'.\n"
+    "\n"
+    "  -y, --yes\n"
+    "      Do not ask for confirmation and apply the install directly.\n"
+    "\n"
+    "  -u [DO NOT USE !!!]\n"
+    "      This is used internally to check updates for an existing install,\n"
+    "      it should not be invoked by the user.\n"
+    "\n"
+    "For bug report or question, please send me an email at :\n"
+    "contact[at]ayabusa[dot]dev ;)\n"
+    );
+}
diff --git a/src/cli.h b/src/cli.h
new file mode 100644 (file)
index 0000000..4893224
--- /dev/null
+++ b/src/cli.h
@@ -0,0 +1,17 @@
+#ifndef CLI_H
+#define CLI_H
+
+enum mode {
+    HELP,
+    UPDATE,
+    NORMAL,
+};
+
+struct ctx {
+    enum mode mode;
+    char *install_loc;
+};
+
+void print_help();
+
+#endif
diff --git a/src/cli.o b/src/cli.o
new file mode 100644 (file)
index 0000000..48003b7
Binary files /dev/null and b/src/cli.o differ
index 3f9f76f4e59b37843219d0e28e325c1f77032f9c..62bafe989f8115e8b1e57a34e06690d83e8aac84 100644 (file)
@@ -6,6 +6,7 @@
 #include <sys/wait.h>
 #include "cpu.h"
 #include "downloader.h"
+#include "cli.h"
 
 #define SED_PATCH "s/WMClass=thorium/WMClass=thorium-browser/g"
 #define DESKTOP_FILE "thorium-portable.desktop"
@@ -45,5 +46,6 @@ int main() {
        fclose(file);
        */
        //printf("Latest version url : '%s,'\n",DL_get_latest_version_url("AVX.zip"));
-       patch_desktop_file(".");
+       //patch_desktop_file(".");
+       print_help();
 }