This commit is contained in:
Andrei Yankovich 2021-07-28 13:17:26 +03:00
parent 864fe83d42
commit cc87accb8b
3 changed files with 20 additions and 21 deletions

View File

@ -3,11 +3,8 @@ Global functions used in applications QuasarApp.
This lib include include next modules: This lib include include next modules:
* Locales - This module use for parse local files. This module allows you to work with translations. * 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. * Params - This module use for parese app params and create log.
* Settings - This is a module that allows you to work with application settings. * Settings - This is a module that allows you to work with application settings.
* Global - This module contains other global functions. * Global - This module contains other global functions.
@ -49,24 +46,13 @@ target_link_libraries(MyBinary PUBLIC QuasarApp)
``` ```
# Usage # Usage
Create objects of the BigInt class, and do what you got to do!
```cpp ```cpp
#include <quasarapp.h> #include <quasarapp.h>
if (!QuasarAppUtils::Params::parseParams(argc, argv)) { if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
QuasarAppUtils::Params::log("Warning message", QuasarAppUtils::Warning); QuasarAppUtils::Params::log("Warning message", QuasarAppUtils::Warning);
QuasarAppUtils::Params::showHelp();
Help::Charters help = {
{
"Main Section ", {
{"-argument1", "description of the argument1"},
{"-argument2", "description of the argument2"},
}
}
};
QuasarAppUtils::Help::print(help);
exit(0); exit(0);
} }
``` ```

View File

@ -74,11 +74,13 @@ bool Params::isDebugBuild() {
#endif #endif
} }
void Params::showHelp(const QString &option) { void Params::showHelp() {
if (userHelp.contains(option))
Help::print(userHelp.value(option)); if (inputOptions.size() > 1) {
else showHelpForInputOptions();
} else {
Help::print(userHelp); Help::print(userHelp);
}
} }
void Params::showHelpForInputOptions() { void Params::showHelpForInputOptions() {

View File

@ -43,6 +43,18 @@ enum VerboseLvl {
* This Class support next comandline arguments. * This Class support next comandline arguments.
* * **-verbose** (level 1 - 3) Shows debug log * * **-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' * * **-fileLog** (path to file) Sets path of log file. Default it is path to executable file with suffix '.log'
*
* ### Usage
*
* ```cpp
#include <quasarapp.h>
if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
QuasarAppUtils::Params::log("Warning message", QuasarAppUtils::Warning);
QuasarAppUtils::Params::showHelp();
exit(0);
}
```
*/ */
class QUASARAPPSHARED_EXPORT Params class QUASARAPPSHARED_EXPORT Params
{ {
@ -144,9 +156,8 @@ public:
/** /**
* @brief showHelp This method shows all help message. * @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. * @brief showHelpForInputOptions This method show help for each input option.