Show a message when no device id's can be autocompleted in zsh
This commit is contained in:
parent
f73ee46fca
commit
656dab4a3f
2 changed files with 10 additions and 1 deletions
|
@ -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));
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
#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
|
||||
|
|
Loading…
Reference in a new issue