about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorComradeCrow <comradecrow@vivaldi.net>2023-05-16 19:35:55 -0700
committerComradeCrow <comradecrow@vivaldi.net>2023-05-16 19:35:55 -0700
commit8972e4b0fdc216bf4ea1c0f7e699689d6c84de6a (patch)
tree0ff00d8a2b25e02e497bcdc38908fbdd97688776 /src
parent1ae69826ba8a1e37fac6800b29e8df1992c002dc (diff)
downloadytcpp-8972e4b0fdc216bf4ea1c0f7e699689d6c84de6a.tar.gz
add more cli versions
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index caf2e9a..1bac482 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -99,21 +99,23 @@ void spawn(const char* url, bool wait) {
 
 void parseSysArgs(int argc, char **argv) {
 
-    // for (int i{0}; i < argc; ++i) {
-    //     cout << argv[i] << " ";
-    // } cout << endl;
-
     string currentArg; 
     for (int i{0}; i < argc; ++i) {
         if (strncmp(argv[i], "-", 1) == 0) {
 
-            currentArg = argv[i];
+            if (strcmp(argv[i], "--version") == 0) {
+
+                cout << PROGRAM_NAME << " v" << VERSION << endl;
+                currentArg = "";
+            } else {
+
+                currentArg = argv[i];
+            }
         } 
         else {
 
             if (currentArg == "") {
 
-                cout << argv[i] << endl;
                 if (strncmp(argv[i], "http://", 7) == 0 || strncmp(argv[i], "https://", 8) == 0) {
                     
                     spawn(argv[i], true);
@@ -122,18 +124,19 @@ void parseSysArgs(int argc, char **argv) {
 
                 cout << "searching for: " << argv[i] << endl;
                 currentArg = "";
-            } else {
-
-                cout << currentArg << ": " << argv[i] << endl;
             }
+            // } else {
+
+            //     cout << currentArg << ": " << argv[i] << endl;
+            // }
         }
     }
 }
 
 int main(int argc, char **argv) {
 
-    validateStructConversions();
-    // parseSysArgs(argc, argv);
+    // validateStructConversions();
+    parseSysArgs(argc, argv);
     // SqliteInterface sqldb;
     // InvidiousApi invapi("https://httpbin.org/get");
     // invapi.test();