mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
Updating adb completion to enable tab-completing file paths for adb shell and pull commands
This commit is contained in:
parent
b0368fd85b
commit
ba68efd543
1 changed files with 19 additions and 0 deletions
|
@ -58,6 +58,21 @@ function __fish_adb_list_uninstallable_packages
|
|||
__fish_adb_run_command pm list packages -3 | string replace 'package:' ''
|
||||
end
|
||||
|
||||
function __fish_adb_list_files
|
||||
set -l token (commandline -ct)
|
||||
|
||||
# Have tab complete show initial / if nothing on current token
|
||||
if test -z "$token"
|
||||
set token "/"
|
||||
end
|
||||
|
||||
# Return list of directories suffixed with '/'
|
||||
__fish_adb_run_command find -H "$token*" -maxdepth 0 -type d 2>/dev/null | awk '{print $1"/"}'
|
||||
# Return list of files
|
||||
__fish_adb_run_command find -H "$token*" -maxdepth 0 -type f 2>/dev/null
|
||||
end
|
||||
|
||||
|
||||
# Generic options, must come before command
|
||||
complete -n '__fish_adb_no_subcommand' -c adb -s s -x -a "(__fish_adb_get_devices)" -d 'Device to communicate with'
|
||||
complete -n '__fish_adb_no_subcommand' -c adb -s d -d 'Communicate with first USB device'
|
||||
|
@ -143,3 +158,7 @@ complete -n '__fish_seen_subcommand_from sideload' -c adb -xa '(__fish_complete_
|
|||
|
||||
# reconnect
|
||||
complete -n '__fish_seen_subcommand_from reconnect' -c adb -x -a 'device' -d 'Kick current connection from device side and make it reconnect.'
|
||||
|
||||
# commands that accept listing device files
|
||||
complete -n '__fish_seen_subcommand_from shell' -c adb -f -a "(__fish_adb_list_files)" -d 'File on device'
|
||||
complete -n '__fish_seen_subcommand_from pull' -c adb -f -a "(__fish_adb_list_files)" -d 'File on device'
|
||||
|
|
Loading…
Reference in a new issue