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:
* 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 <quasarapp.h>
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);
}
```

View File

@ -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() {

View File

@ -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 <quasarapp.h>
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.