diff --git a/parameterManager.cpp b/parameterManager.cpp index e86a3c7..6f9085d 100644 --- a/parameterManager.cpp +++ b/parameterManager.cpp @@ -911,7 +911,7 @@ int unterOption_info(Settings *settings, int argc, char **argv) settings->name.pop_back(); if(settings->debugMode) { std::cout << "Name: " << settings->name << std::endl; - std::cout << "Modus: Search_MODUS" << std::endl; + std::cout << "Modus: IndosModus" << std::endl; } return 0; @@ -1166,7 +1166,7 @@ int unterOption_news(Settings *settings, int argc, char **argv) } if(settings->debugMode) - std::cout << "Modus: Search_MODUS" << std::endl; + std::cout << "Modus: NewsModus" << std::endl; return 0; } @@ -1229,7 +1229,7 @@ int unterOption_update(Settings *settings, int argc, char **argv) } if(settings->debugMode) - std::cout << "Modus: Search_MODUS" << std::endl; + std::cout << "Modus: UpdateModus" << std::endl; return 0; } @@ -1316,19 +1316,60 @@ bool removeDirIsOk(std::string path, Settings *settings) return true; } +int unterOption_RemoveSettings_or_CacheDir(Settings *settings, int argc, char **argv) +{ + settings->modus = Modus::REMOVE_SETTINGS_AND_CACHE_MODUS; + + int c = 0; + const option long_opts[] = { + {"", required_argument, nullptr, 'p'}, + + {"help", no_argument, nullptr, 'h'}, + {"debug-mode", no_argument, nullptr, 'd'}, + + {nullptr, no_argument, nullptr, 0} + + }; + + while( ( c = getopt_long (argc, argv, "p:hd", long_opts, nullptr) ) != -1 ) { + switch(c) { + + case 'h': + unterOption_update_help(settings->programName); + return -1; + case 'd': + settings->debugMode = true; + if(settings->debugMode) + std::cout << "Debug Modus: true" << std::endl; + break; + default: + std::cout << "Aufruf: " << settings->programName << " --update [OPTION]..." << std::endl; + std::cout << "\"" << settings->programName << " --update --help\" liefert weitere Informationen." << std::endl; + return 21; + } + } + + if(settings->debugMode) + std::cout << "Modus: RemoveModus" << std::endl; + + return 0; +} +void unterOption_RemoveSettings_or_CacheDire_help(std::string programName) +{ + std::cout << "Aufruf: " << programName << " --aa [OPTION]..." << std::endl << std::endl; + std::cout << "Beschreibung:" << std::endl + << " Mit dieser Unterfunktion kann man das Programm updaten." << std::endl << std::endl; - - - - - - - - - - - - + std::cout << "OPTIONEN:" << std::endl + << " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl + << " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl + << " Standart: 127.0.0.1:9050" << std::endl << std::endl + << " -d, --debug-mode" << std::endl + << " Mit dieser Option kann man den Debug-Modus einschalten." << std::endl + << " Dabei werden vielmehr Infos ausgegeben." << std::endl << std::endl + << " -h, --help" << std::endl + << " Mit dieser Option wird dieses Helpmenue ausgegeben." << std::endl; +} diff --git a/parameterManager.h b/parameterManager.h index 02aa45f..15e980e 100644 --- a/parameterManager.h +++ b/parameterManager.h @@ -31,7 +31,8 @@ enum Modus { SEARCH_MODUS = 2, INFO_MODUS = 3, NEWS_MODUS = 4, - UPDATE_MODUS = 5 + UPDATE_MODUS = 5, + REMOVE_SETTINGS_AND_CACHE_MODUS = 6 }; @@ -124,6 +125,9 @@ void unterOption_news_help(std::string programName); int unterOption_update(Settings * settings, int argc, char **argv); void unterOption_update_help(std::string programName); +int unterOption_RemoveSettings_or_CacheDir(Settings * settings, int argc, char **argv); +void unterOption_RemoveSettings_or_CacheDire_help(std::string programName); + int setS5ProxytoSettings(Settings &settings, std::string optarg);