diff options
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | src/main.cpp | 25 |
2 files changed, 25 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ee4387b..9e3f249 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ if(NOT ftxui_POPULATED) endif() FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git - GIT_TAG c4713a704ca12237485ecbfec185f76c2a81bd09) + GIT_TAG 86545977e719fe3a54c407845e8cd340d15f0fd2) FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz URL_HASH SHA256=8c4b26bf4b422252e13f332bc5e388ec0ab5c3443d24399acb675e68278d341f) ##https://github.com/nlohmann/json/releases/latest/download/json.tar.xz @@ -48,11 +48,20 @@ else() endif() -add_executable(${PROJECT_NAME} src/main.cpp src/tui.cpp src/invapi.cpp src/YtdlpWrapper.cpp src/sqliteinterface.cpp src/video.cpp) +add_executable(${PROJECT_NAME} + src/main.cpp + src/tui.cpp + src/invapi.cpp + src/YtdlpWrapper.cpp + src/sqliteinterface.cpp + src/video.cpp +) + target_include_directories(${PROJECT_NAME} PRIVATE src) target_compile_definitions(${PROJECT_NAME} PRIVATE DEF_APPDATA="${DEF_APPDATA}" + PRIVATE PROGRAM_NAME="${PROJECT_NAME}" PRIVATE VERSION="${PROJECT_VERSION}" ) 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(); |