Improve cmd arg handling
This commit is contained in:
parent
49b197ff60
commit
1db3b693f8
2 changed files with 13 additions and 3 deletions
|
@ -20,8 +20,11 @@ REL = 2
|
|||
VERSION = $${VER}-$${REL}
|
||||
$$system(bash update-spec-version.sh $$TARGET $$VER $$REL)
|
||||
DEFINES += APP_VERSION=\"\\\"$$VERSION\\\"\"
|
||||
DEFINES += APP_NAME=\"\\\"$$TARGET\\\"\"
|
||||
|
||||
# Do not set this! Use "--verbose" and "--debug" instead.
|
||||
# Do not define QT_NO_DEBUG_OUTPUT!
|
||||
# Use "--verbose" and "--debug" at runtime instead.
|
||||
# See main() for details.
|
||||
#DEFINES += QT_NO_DEBUG_OUTPUT
|
||||
|
||||
HEADERS += \
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <QQmlEngine>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
#include <iostream>
|
||||
|
||||
#include "battery.h"
|
||||
#include "settings.h"
|
||||
|
@ -47,13 +46,21 @@ int main(int argc, char *argv[])
|
|||
const char* logEnvVar = "QT_LOGGING_RULES";
|
||||
for(int i = 1; i < argc; i++) {
|
||||
if(!strcmp(argv[i],"-v")) {
|
||||
std::cout << "Battery Buddy " << APP_VERSION << std::endl << std::flush;
|
||||
printf("%s %s\n", APP_NAME, APP_VERSION);
|
||||
return 0;
|
||||
}
|
||||
else if(!strcmp(argv[i],"--verbose"))
|
||||
qputenv(logEnvVar, "*.info=true;*.debug=false");
|
||||
else if(!strcmp(argv[i],"--debug"))
|
||||
qputenv(logEnvVar, "*.info=true");
|
||||
else if(!strcmp(argv[i],"--help")) {
|
||||
printf("%s %s\n", APP_NAME, APP_VERSION);
|
||||
printf("Usage:\n");
|
||||
printf(" --verbose Enable informational messages\n");
|
||||
printf(" --debug Enable informational and debugging messages\n");
|
||||
printf(" --help Print version string and exit\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(!qEnvironmentVariableIsSet(logEnvVar))
|
||||
qputenv(logEnvVar, "*.info=false;*.debug=false");
|
||||
|
|
Loading…
Reference in a new issue