diff --git a/src/core.cpp b/src/core.cpp new file mode 100644 index 0000000..9a7f302 --- /dev/null +++ b/src/core.cpp @@ -0,0 +1,42 @@ +#include "pch.hpp" + +int main(int argc, char* argv[]) { + + //cli arg flags + bool start = false, + stop = false, + d = false, + h = false, + gui = false; + + int idx = 1; + + //find and handle cli args + if(strcmp(argv[idx], "start") == 0 || argc < idx) { + std::cout << "start daemon\n"; + start = true; + idx++; + } else if(strcmp(argv[idx], "stop") == 0 && argc >= idx) { + std::cout << "stop daemon\n"; + stop = true; + idx++; + } else { + std::cout << "Argument \"" << argv[idx] << "\" at index " << idx << " is unknown or duplicated.\n"; + } + + for(int& i = idx; i < argc; i++) { + + if(!h && strcmp(argv[i], "-h") == 0) { + std::cout << "print help\n"; + d = true; + } else if(!d && strcmp(argv[i], "-d") == 0) { + std::cout << "init daemon\n"; + gui = true; + } else if(!gui && strcmp(argv[i], "-gui") == 0) { + std::cout << "init gui\n"; + gui = true; + } else { + std::cout << "Argument \"" << argv[i] << "\" at index " << i << " is unknown or duplicated.\n"; + } + } +} diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 7e3d0ca..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "pch.hpp" - - -int main(int argc, char* argv[]) { - - for(int i = 0; i < argc; i++) { - std::cout << argv[i] << std::endl; - } -} diff --git a/src/pch.hpp b/src/pch.hpp index 604782e..06be895 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -1 +1,7 @@ +#ifndef PCH_HPP +#define PCH_HPP + #include +#include + +#endif