Commit 656dab4a authored by Matthijs Tijink's avatar Matthijs Tijink

Show a message when no device id's can be autocompleted in zsh

parent f73ee46f
Pipeline #7800 passed with stage
in 8 minutes and 7 seconds
......@@ -165,6 +165,9 @@ int main(int argc, char** argv)
//Output id and description
QTextStream(stdout) << id << '[' << description << ']' << endl;
}
//Exit with 1 if we didn't find a device
return int(!devices.isEmpty());
} else if(parser.isSet(QStringLiteral("refresh"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect"), QStringLiteral("org.kde.kdeconnect.daemon"), QStringLiteral("forceOnNetworkChange"));
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
......
#compdef kdeconnect-cli
_kdeconnect_device-ids() {
_values "KDE Connect device id" "${(f)$(kdeconnect-cli --shell-device-autocompletion=zsh 2>/dev/null)}"
local devices=''
devices="$(kdeconnect-cli --shell-device-autocompletion=zsh 2>/dev/null)"
if [[ $? -eq 0 ]]; then
_values "KDE Connect device id" "${(f)devices}"
else
_message -r "No KDE Connect devices reachable."
fi
}
#See http://zsh.sourceforge.net/Doc/Release/Completion-System.html#index-_005farguments for autocomplete documentation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment