diff --git a/README.md b/README.md index 03d4b99..b538c4c 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,8 @@ Global functions used in applications QuasarApp. This lib include include next modules: * Locales - This module use for parse local files. This module allows you to work with translations. - * Params - This module use for parese app params and create log. - * Settings - This is a module that allows you to work with application settings. - * Global - This module contains other global functions. @@ -49,24 +46,13 @@ target_link_libraries(MyBinary PUBLIC QuasarApp) ``` # Usage -Create objects of the BigInt class, and do what you got to do! ```cpp #include if (!QuasarAppUtils::Params::parseParams(argc, argv)) { QuasarAppUtils::Params::log("Warning message", QuasarAppUtils::Warning); - - Help::Charters help = { - { - "Main Section ", { - {"-argument1", "description of the argument1"}, - {"-argument2", "description of the argument2"}, - } - } - }; - - QuasarAppUtils::Help::print(help); + QuasarAppUtils::Params::showHelp(); exit(0); } ``` diff --git a/params.cpp b/params.cpp index 81a4ac1..ef32875 100644 --- a/params.cpp +++ b/params.cpp @@ -74,11 +74,13 @@ bool Params::isDebugBuild() { #endif } -void Params::showHelp(const QString &option) { - if (userHelp.contains(option)) - Help::print(userHelp.value(option)); - else +void Params::showHelp() { + + if (inputOptions.size() > 1) { + showHelpForInputOptions(); + } else { Help::print(userHelp); + } } void Params::showHelpForInputOptions() { diff --git a/params.h b/params.h index 7ac1f0b..d1c6503 100644 --- a/params.h +++ b/params.h @@ -43,6 +43,18 @@ enum VerboseLvl { * This Class support next comandline arguments. * * **-verbose** (level 1 - 3) Shows debug log * * **-fileLog** (path to file) Sets path of log file. Default it is path to executable file with suffix '.log' + * + * ### Usage + * + * ```cpp + #include + + if (!QuasarAppUtils::Params::parseParams(argc, argv)) { + QuasarAppUtils::Params::log("Warning message", QuasarAppUtils::Warning); + QuasarAppUtils::Params::showHelp(); + exit(0); + } + ``` */ class QUASARAPPSHARED_EXPORT Params { @@ -144,9 +156,8 @@ public: /** * @brief showHelp This method shows all help message. - * @param option This is option key that needed show a help message. */ - static void showHelp(const QString& option = ""); + static void showHelp(); /** * @brief showHelpForInputOptions This method show help for each input option.