From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21558 invoked by alias); 18 Mar 2016 16:14:08 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 38179 Received: (qmail 24232 invoked from network); 18 Mar 2016 16:14:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=ho8L/3tVPysmU/Kpjprq7mAaVp4l1SCoi5450nWnH70=; b=kG79uu0lS0jBJ2crNR8hRk+DAg6pAoRZOOeMiclRsVp8CYc2NubkGTrTM/1Co69OnV Keng3Hl2fZdGlt9lRj0SdQVM7VLAlOEMkMnGcBGl2RzSt9+q7iUlVD0y1zcE8S/J49ZY hYcI1tsRVeruD1M4KYgJDxGipInCODTHp1aTPkRVd2xSBiVpiBt5MyVotF+0aySTSo8Y NYPQm4HdhecDm7jwGDTdKm5J6EESU/CHth0v4j19WVnWPkriWr2iTVP8zHx1COU93bBJ Rux3sSHaUAPWh/VZuKbjvFOiBFpGA3e+1nDGNylYipJIc/ovU+3kIkhDQpnC6oXGArzX m1pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=ho8L/3tVPysmU/Kpjprq7mAaVp4l1SCoi5450nWnH70=; b=VoKigfuGkGIl44PwwlJCJExlEqQ+0NTEaldtjUHISmayTWQAbSPS3F2ZBPoQEifPbM vELcJ1fJbOfxCbCQ5cSh1jIDJxmYz6SvycdP/aBoU6KybNrOcun3jo4fZ4Pw1Zkrt1SQ MaIg5t4xLhMO1PqBozozq3hZIbtOAxU2kcBqXDZM5bC+BOuphpRIOJmU/a4KPPblvo5p xQ0rKliFDqFhYPBj1VOP/9Z+POlu9w111Qwn9DJtj6q2M5GShuZ00psH7Kaw0zxxR1JD frOH7Q+zkRfOk6EDmomCvD1q6CES0+PF/OgHZxmPQfWDLhatLFc1UTR6q+d4POr9VUy4 NH+w== X-Gm-Message-State: AD7BkJIFzWoYju3FOnziK9XBmnCoGUvsdx1zOPKkTvfp5LmP036N9TppJMLgJV2W1tbzkg== X-Received: by 10.28.46.132 with SMTP id u126mr147390wmu.67.1458317343396; Fri, 18 Mar 2016 09:09:03 -0700 (PDT) From: Mikael Magnusson To: zsh-workers@zsh.org Subject: PATCH: Fix "35531: fallback on file completion" Date: Fri, 18 Mar 2016 17:08:56 +0100 Message-Id: <1458317336-27434-1-git-send-email-mikachu@gmail.com> X-Mailer: git-send-email 2.6.1 The above commit just changed a bunch of stuff without testing, the result was that the completer didn't work. It now works, to an extent. The one remaining caveat is that if you enter a subcommand the completer doesn't recognize, it will go on to offer subcommands instead of falling back to _default. I'm not sure what it's trying to do with the "sanitize context" stuff, or "shift words" etc which just makes the rest of the code not know where it is, but I don't care enough to rewrite it. --- ChangeLog | 2 -- Completion/Unix/Command/_adb | 74 +++++++++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index be61bd0..aa5a716 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2659,8 +2659,6 @@ 2015-06-19 Oliver Kiddle - * 35531: Completion/Unix/Command/_adb: fallback on file completion - * 35527: Completion/Unix/Type/_email_addresses, Completion/Zsh/Command/_fc, Completion/Zsh/Command/_zpty: use list-separator style in cases where separator was hardcoded diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index 88aca24..5ad2f5d 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -37,34 +37,45 @@ _adb() { local -a ALL_ADB_COMMANDS ALL_ADB_COMMANDS=( + "backup" + "bugreport" "connect" + "devices" + "disable-verity" "disconnect" - "shell" - "wait-for-device" - "push" - "pull" - "logcat" - "jdwp" - "bugreport" - "version" + "emu" + "enable-verity" "forward" - "install" - "uninstall" + "get-devpath" + "get-serialno" + "get-state" "help" - "start-server" + "install" + "install-multiple" + "jdwp" + "keygen" "kill-server" - "devices" - "get-state" - "get-serialno" - "status-window" - "remount" + "logcat" + "ppp" + "pull" + "push" "reboot" "reboot-bootloader" + "remount" + "restore" + "reverse" "root" - "usb" - "tcpip" + "shell" "sideload" - "ppp" + "start-server" + "status-window" + "sync" + "tcpip" + "uninstall" + "unroot" + "usb" + "version" + "wait-for-device" ) (( $+functions[_adb_device_specification] )) && _adb_device_specification @@ -77,7 +88,7 @@ _adb() { '( -e -s)-d[device]' \ '(-d -s)-e[emulator]' \ '1:"options":_adb_options_handler' \ - '*: : _default' + '*: : _default' return; } @@ -100,28 +111,29 @@ _adb_dispatch_command () { fi case ${curcontext} in - (*:adb-shell) + (*:adb:shell) (( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell ;; - (*:adb-connect|*:adb-disconnect) + (*:adb:connect|*:adb:disconnect) (( $+functions[_adb_dispatch_connection_handling] )) && _adb_dispatch_connection_handling ;; - (*:adb-logcat) + (*:adb:logcat) (( $+functions[_adb_dispatch_logcat] )) && _adb_dispatch_logcat ;; - (*:adb-push) + (*:adb:push) (( $+functions[_adb_dispatch_push] )) && _adb_dispatch_push ;; - (*:adb-pull) + (*:adb:pull) (( $+functions[_adb_dispatch_pull] )) && _adb_dispatch_pull ;; - (*:adb-install) + (*:adb:install) (( $+functions[_adb_dispatch_install] )) && _adb_dispatch_install ;; - (*:adb-uninstall) + (*:adb:uninstall) (( $+functions[_adb_dispatch_uninstall] )) && _adb_dispatch_uninstall ;; - (*:adb-*) + (*:adb:(${(~j:|:)ALL_ADB_COMMANDS})) + # subcommand not handled _default ;; (*) @@ -147,7 +159,7 @@ _adb_sanitize_context () { done ##expand unquoted to remove sparse elements mywords=( ${mywords[@]} ) - (( $#mywords )) && curcontext="${curcontext%:*}-${mywords[-1]}:" + curcontext="${curcontext}${mywords[-1]}" } (( $+functions[_adb_device_specification] )) || @@ -377,9 +389,9 @@ _adb_dispatch_connection_handling () { fi } -(( $+functions[_adb_check_log_redirect] )) || +(( $+functions[adb_check_log_redirect] )) || _adb_check_log_redirect () { - LOG_REDIRECT=${$(adb ${=ADB_DEVICE_SPECIFICATION} shell getprop log.redirect-stdio 2>/dev/null)// + LOG_REDIRECT=${$(adb ${=ADB_DEVICE_SPECIFICATION} shell getprop log.redirect-stdio)// /} [[ ${LOG_REDIRECT[1,4]} == "true" ]] && _message -r "Notice: stdio log redirection enabled on the device, so some completions will not work" } -- 2.6.1