mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
fix: improve the cli support
This commit is contained in:
parent
fe64b2cd19
commit
0adeaf9c28
@ -57,11 +57,6 @@ int main(int argc, char *argv[])
|
|||||||
: static_cast<IVpn*>(new VpnDbus(nullptr)); // Contact GPService daemon via dbus
|
: static_cast<IVpn*>(new VpnDbus(nullptr)); // Contact GPService daemon via dbus
|
||||||
GPClient w(nullptr, vpn);
|
GPClient w(nullptr, vpn);
|
||||||
|
|
||||||
parser.isSet("start-minimized") ? w.showMinimized() : w.show();
|
|
||||||
if (parser.isSet("reset")) {
|
|
||||||
w.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (positional.size() > 0) {
|
if (positional.size() > 0) {
|
||||||
w.portal(positional.at(0));
|
w.portal(positional.at(0));
|
||||||
}
|
}
|
||||||
@ -81,12 +76,21 @@ int main(int argc, char *argv[])
|
|||||||
sigwatch.watchForSignal(SIGHUP);
|
sigwatch.watchForSignal(SIGHUP);
|
||||||
QObject::connect(&sigwatch, &UnixSignalWatcher::unixSignal, &w, &GPClient::quit);
|
QObject::connect(&sigwatch, &UnixSignalWatcher::unixSignal, &w, &GPClient::quit);
|
||||||
|
|
||||||
if (parser.isSet("now")) {
|
|
||||||
w.doConnect();
|
|
||||||
}
|
|
||||||
if (parser.isSet("json")) {
|
if (parser.isSet("json")) {
|
||||||
QObject::connect(static_cast<VpnJson*>(vpn), &VpnJson::connected, &w, &GPClient::quit);
|
QObject::connect(static_cast<VpnJson*>(vpn), &VpnJson::connected, &w, &GPClient::quit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parser.isSet("reset")) {
|
||||||
|
w.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parser.isSet("now")) {
|
||||||
|
w.doConnect();
|
||||||
|
} else if (parser.isSet("start-minimized")) {
|
||||||
|
w.showMinimized();
|
||||||
|
} else {
|
||||||
|
w.show();
|
||||||
|
}
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user