Fastboot command auto-completion

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.