Skip to content

Commit 77305c3

Browse files
committed
Rename "-v" & "--verbose" options to "-i" & "--info to not overlap with version information
1 parent a50d8b9 commit 77305c3

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
### ⚠️ Breaking Changes
1010

11+
- Rename "-v" & "--verbose" options to "-i" & "--info to not overlap with version information
12+
1113
#### JSON-API
1214
- Standardized subscription update elements: `ledcolors-imagestream-update`, `ledcolors-ledstream-update`, and `logmsg-update` now return data under `data` instead of `result`.
1315
- Global configuration elements are now separated from instance-specific ones.

src/hyperiond/main.cpp

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555

5656
using namespace commandline;
5757

58+
namespace {
59+
inline const QString APPLICATION_NAME = QStringLiteral("Hyperion Daemon");
60+
}
61+
5862
#define PERM0664 (QFileDevice::ReadOwner | QFileDevice::ReadGroup | QFileDevice::ReadOther | QFileDevice::WriteOwner | QFileDevice::WriteGroup)
5963

6064
QCoreApplication* createApplication(int& argc, char* argv[])
@@ -135,23 +139,26 @@ int main(int argc, char** argv)
135139

136140
bool isGuiApp = !(qobject_cast<QApplication*>(app.data()) == nullptr) && QSystemTrayIcon::isSystemTrayAvailable();
137141

142+
app->setApplicationName(APPLICATION_NAME);
143+
app->setApplicationVersion(QString("%1 (%2)").arg(HYPERION_VERSION, HYPERION_BUILD_ID));
144+
138145
// force the locale
139146
setlocale(LC_ALL, "C");
140147
QLocale::setDefault(QLocale::c());
141148

142-
Parser parser("Hyperion Daemon");
149+
Parser parser(APPLICATION_NAME);
143150
parser.addHelpOption();
151+
parser.addVersionOption();
144152

145-
BooleanOption& versionOption = parser.add<BooleanOption>(0x0, "version", "Show version information");
146153
Option& userDataOption = parser.add<Option>('u', "userdata", "Overwrite user data path, defaults to home directory of current user (%1)", QDir::homePath() + "/.hyperion");
147154
BooleanOption& resetPassword = parser.add<BooleanOption>(0x0, "resetPassword", "Lost your password? Reset it with this option back to 'hyperion'");
148155
BooleanOption& readOnlyModeOption = parser.add<BooleanOption>(0x0, "readonlyMode", "Start in read-only mode. No updates will be written to the database");
149156
BooleanOption& deleteDB = parser.add<BooleanOption>(0x0, "deleteDatabase", "Start all over? This Option will delete the database");
150157
Option& importConfig = parser.add<Option>(0x0, "importConfig", "Replace the current configuration database by a new configuration");
151158
Option& exportConfigPath = parser.add<Option>(0x0, "exportConfig", "Export the current configuration database, defaults to home directory of current user (%1)", QDir::homePath() + "/.hyperion//archive");
152159
BooleanOption& silentOption = parser.add<BooleanOption>('s', "silent", "Do not print any outputs");
153-
BooleanOption& verboseOption = parser.add<BooleanOption>('v', "verbose", "Increase verbosity");
154-
BooleanOption& debugOption = parser.add<BooleanOption>('d', "debug", "Show debug messages");
160+
BooleanOption& infoMsgOption = parser.add<BooleanOption>('i', "info", "Show Info messages");
161+
BooleanOption& debugMsgOption = parser.add<BooleanOption>('d', "debug", "Show Debug messages");
155162

156163
parser.add<BooleanOption>(0x0, "desktop", "Show systray on desktop");
157164
parser.add<BooleanOption>(0x0, "service", "Force hyperion to start as console service");
@@ -169,16 +176,6 @@ int main(int argc, char** argv)
169176
openConsole(false);
170177
#endif
171178

172-
if (parser.isSet(versionOption))
173-
{
174-
std::cout
175-
<< "Hyperion Ambilight Deamon" << "\n"
176-
<< "\tVersion : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << "\n"
177-
<< "\tBuild Time: " << __DATE__ << " " << __TIME__ << "\n";
178-
179-
return EXIT_SUCCESS;
180-
}
181-
182179
if (!parser.isSet(waitOption))
183180
{
184181
if (getProcessIdsByProcessName(processName).size() > 1)
@@ -223,19 +220,19 @@ int main(int argc, char** argv)
223220
logLevelCheck++;
224221
}
225222

226-
if (parser.isSet(verboseOption))
223+
if (parser.isSet(infoMsgOption))
227224
{
228225
Logger::setLogLevel(Logger::INFO);
229226
logLevelCheck++;
230227
}
231228

232-
if (parser.isSet(debugOption))
229+
if (parser.isSet(debugMsgOption))
233230
{
234231
Logger::setLogLevel(Logger::DEBUG);
235232
logLevelCheck++;
236233
}
237234

238-
Info(log, "Hyperion %s, %s, built: %s:%s", HYPERION_VERSION, HYPERION_BUILD_ID, __DATE__, __TIME__);
235+
Info(log, "%s %s, %s, built: %s:%s", QSTRING_CSTR(APPLICATION_NAME), HYPERION_VERSION, HYPERION_BUILD_ID, __DATE__, __TIME__);
239236
Debug(log, "QtVersion [%s]", QT_VERSION_STR);
240237

241238
if (logLevelCheck > 1)

0 commit comments

Comments
 (0)