From f0c5484eda64065b756762cc14ed87e5c4a21e53 Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Sat, 11 Mar 2023 06:42:54 +0800 Subject: [PATCH] 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> --- share/completions/adb.fish | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/completions/adb.fish b/share/completions/adb.fish index c8687dccc..cb1059c5c 100644 --- a/share/completions/adb.fish +++ b/share/completions/adb.fish @@ -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'