completions/adb: unroot and optimize devices show (#9650)

* completions/adb: add unroot command

Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com>

* completions/adb: use product and model both to show device

Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com>

---------

Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com>
(cherry picked from commit f0c5484eda)
This commit is contained in:
NextAlone 2023-03-11 06:42:54 +08:00 committed by Mahmoud Al-Qudsi
parent 4497f58b3e
commit 9b790287ef

View File

@ -2,7 +2,7 @@
function __fish_adb_no_subcommand -d 'Test if adb has yet to be given the subcommand'
for i in (commandline -opc)
if contains -- $i connect disconnect devices push pull sync shell emu logcat install uninstall jdwp forward bugreport backup restore version help start-server kill-server remount reboot get-state get-serialno get-devpath status-window root usb tcpip ppp sideload reconnect
if contains -- $i connect disconnect devices push pull sync shell emu logcat install uninstall jdwp forward bugreport backup restore version help start-server kill-server remount reboot get-state get-serialno get-devpath status-window root usb tcpip ppp sideload reconnect unroot
return 1
end
end
@ -14,7 +14,7 @@ function __fish_adb_get_devices -d 'Run adb devices and parse output'
set -l procs (ps -Ao comm= | string match 'adb')
# Don't run adb devices unless the server is already started - it takes a while to init
if set -q procs[1]
adb devices -l | string replace -rf '(\S+).*model:(\S+).*' '$1'\t'$2'
adb devices -l | string replace -rf '(\S+).*product:(\S+).*model:(\S+).*' '$1'\t'$2 $3'
end
end
@ -118,6 +118,7 @@ complete -f -n __fish_adb_no_subcommand -c adb -a get-serialno -d 'Prints serial
complete -f -n __fish_adb_no_subcommand -c adb -a get-devpath -d 'Prints device path'
complete -f -n __fish_adb_no_subcommand -c adb -a status-window -d 'Continuously print the device status'
complete -f -n __fish_adb_no_subcommand -c adb -a root -d 'Restart the adbd daemon with root permissions'
complete -f -n __fish_adb_no_subcommand -c adb -a unroot -d 'Restart the adbd daemon without root permissions'
complete -f -n __fish_adb_no_subcommand -c adb -a usb -d 'Restart the adbd daemon listening on USB'
complete -f -n __fish_adb_no_subcommand -c adb -a tcpip -d 'Restart the adbd daemon listening on TCP'
complete -f -n __fish_adb_no_subcommand -c adb -a ppp -d 'Run PPP over USB'