From e2599545f2804c83dab195aa56d85a759fc895aa Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Thu, 9 Feb 2023 13:20:33 +0800 Subject: [PATCH] completions/fastboot: fix flash completion Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com> (cherry picked from commit c587b2ffcc8736c967876060fff5afcd0e745b07) --- share/completions/fastboot.fish | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/share/completions/fastboot.fish b/share/completions/fastboot.fish index cb7f0ed8f..05862b093 100644 --- a/share/completions/fastboot.fish +++ b/share/completions/fastboot.fish @@ -1,15 +1,19 @@ set -l commands flashall getvar oem flashing reboot update erase format devices flash get_staged help stage boot fetch function __fish_fastboot_list_partition_or_file - if __fish_seen_subcommand_from (__fish_fastboot_list_partition){_a,_b,} - __fish_complete_path - else - __fish_fastboot_list_partition + set -l tokens (commandline -opc) + # if last 2 token is flash, then list file + if test (count $tokens) -gt 2 + if test $tokens[-2] = flash + __fish_complete_path + return + end end + __fish_fastboot_list_partition end function __fish_fastboot_list_partition - set -l partitions boot bootloader dtbo modem odm odm_dlkm oem product pvmfw radio recovery system vbmeta vendor vendor_dlkm cache userdata system_ext + set -l partitions boot bootloader cache cust dtbo metadata misc modem odm odm_dlkm oem product pvmfw radio recovery system system_ext userdata vbmeta vendor vendor_dlkm vmbeta_system for i in $partitions echo $i end @@ -73,4 +77,3 @@ complete -n '__fish_seen_subcommand_from reboot' -c fastboot -xa 'bootloader fas # oem complete -n '__fish_seen_subcommand_from oem' -c fastboot -xa 'device-info lock unlock edl' -