Fastboot command auto-completion
On Ubuntu 13.10 and later Ubuntu 14.04, after installing fastboot and adb tools through APT, we found that there was a problem with Automatic completion of fastboot, and there was a problem with Automatic completion of fastboot flash, in particular, files of the mbn and bin types cannot be completed.
After checking, we found that the fastboot Automatic completion script restricts the completion rules, and a slight modification can solve this problem.
File Path:/etc/bash_completion.d/fastboot
Modify the content as follows:
_ 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 rpm sbl1 modem tz persist splash failed t" -- $ 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 }*"))
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
Log out, log on to the system again, and try the fastboot flash command again. You will find it easier to use than before.
This article permanently updates the link address: