blob: 06a501adc58306d684f7ea92c02f9344ca740af1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* Copyright (C) 2023 The Qt Company Ltd.
*
* SPDX-License-Identifier: GPL-3.0-only WITH Qt-GPL-exception-1.0
*/
#include "commonsetup.h"
#include "qtlicensetool.h"
using namespace QLicenseService;
int main(int argc, char *argv[])
{
// Fetch the settings from .ini file
LicdSetup setup(e_set_type_licensetool, LicdSetup::getQtAppDataLocation() + USER_SETTINGS_FILE);
if (setup.initSettings() == e_file_not_present) {
errorAndExit("Not able to find the settings");
}
if (argc < 2) {
errorAndExit("No arguments given");
}
std::string action = argv[1];
// Get rid of commands which don't require further actions
if (action == "--version" || action == "-v") {
showVersion();
return 0;
} else if (action == "--help" || action == "-h") {
helpAndExit();
}
// Then those requiring connection
if (action == "--permanent" || action == "-p") {
// Override setup with cmd-line args:
overrideSetup(&setup, argc, argv);
doPermanentRequest(&setup);
} else if (action == "--serverversion" || action == "-S") {
askStatus(SERVER_VERSION_CMD, &setup);
} else if (action == "--daemonversion" || action == "-D") {
askStatus(DAEMON_VERSION_CMD, &setup);
} else if (action == "--reservation" || action == "-r") {
askStatus(RESERVATION_QUERY_CMD, &setup);
} else {
errorAndExit("Invalid parameters");
}
}
|