/etc/bash_completion.d/fastboot is in android-tools-fastboot 4.2.2+git20130218-3ubuntu23.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | _fastboot()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="reboot boot flash devices -w reboot-bootloader"
case "$prev" in
reboot | devices | -w | reboot-bootloader)
COMPREPLY=()
return 0
;;
flash)
COMPREPLY=( $(compgen -W "boot system recovery radio" -- $cur ))
return 0
;;
boot)
COMPREPLY=( $(compgen -o filenames -G "${cur}*.img"))
return 0
;;
*)
local prev2="${COMP_WORDS[COMP_CWORD-2]}"
local prev3="${COMP_WORDS[COMP_CWORD-3]}"
if [ "$prev2" == "flash" ];then
COMPREPLY=( $(compgen -o filenames -G "${cur}*.img"))
return 0
elif [ "$prev2" == "boot" ];then
COMPREPLY=()
return 0
elif [ "$prev3" == "flash" ];then
COMPREPLY=()
return 0
fi
;;
esac
COMPREPLY=( $(compgen -W "$opts" -- $cur) )
return 0
}
complete -F _fastboot fastboot
|