author | Anatol Pomozov
<anatolik@archlinux.org> 2016-01-13 17:44:55 UTC |
committer | Anatol Pomozov
<anatolik@archlinux.org> 2016-01-13 17:44:55 UTC |
parent | f0a82241be8eb8591d82d31ad4a8c387d1f75df6 |
PKGBUILD | +7 | -4 |
bash_completion => bash_completion.adb | +0 | -68 |
bash_completion.fastboot | +90 | -0 |
diff --git a/PKGBUILD b/PKGBUILD index 65854bc..6dd1431 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -4,7 +4,7 @@ pkgname=android-tools pkgver=6.0.1_r10 -pkgrel=1 +pkgrel=2 pkgdesc='Android platform tools' arch=(i686 x86_64) url='http://tools.android.com/' @@ -17,14 +17,16 @@ source=(git+https://android.googlesource.com/platform/system/core#tag=android-$p git+https://android.googlesource.com/platform/external/f2fs-tools#tag=android-$pkgver build.sh # regenerate this file with generate_build.rb tool fix_build.patch - bash_completion) # Bash completion file was taken from https://github.com/mbrubeck/android-completion + bash_completion.fastboot + bash_completion.adb) # Bash completion file was taken from https://github.com/mbrubeck/android-completion sha1sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'd47604b60cc123641d52eed8f6495265725bf9d3' '40a978209b6d1bbf99e04b8bd5fca6429b97f1b1' - 'e1bd94fd4dd260af3c068496071d67738d431aec') + '7004dbd0c193668827174880de6f8434de8ceaee' + '2e69152091bb9642be058e49ec6cb720a2fd91dc') prepare() { patch -p1 < fix_build.patch @@ -37,5 +39,6 @@ build() { package(){ install -m755 -d "$pkgdir"/usr/bin install -m755 -t "$pkgdir"/usr/bin mkbootimg fastboot adb - install -Dm 644 bash_completion "$pkgdir"/usr/share/bash-completion/completions/$pkgname + install -Dm 644 bash_completion.fastboot "$pkgdir"/usr/share/bash-completion/completions/fastboot + install -Dm 644 bash_completion.adb "$pkgdir"/usr/share/bash-completion/completions/adb } diff --git a/bash_completion b/bash_completion.adb similarity index 70% rename from bash_completion rename to bash_completion.adb index cec57f2..511d531 100644 --- a/bash_completion +++ b/bash_completion.adb @@ -133,71 +133,3 @@ function _adb() esac } complete -o default -F _adb adb - -function _fastboot() -{ - local cur prev opts cmds c subcommand device_selected - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="-w -s -p -c -i -b -n" - cmds="update flashall flash erase getvar boot devices \ - reboot reboot-bootloader oem continue" - subcommand="" - partition_list="boot recovery system userdata bootloader radio" - device_selected="" - - # Look for the subcommand. - c=1 - while [ $c -lt $COMP_CWORD ]; do - word="${COMP_WORDS[c]}" - if [ "$word" = "-s" ]; then - device_selected=true - fi - for cmd in $cmds; do - if [ "$cmd" = "$word" ]; then - subcommand="$word" - fi - done - c=$((++c)) - done - - case "${subcommand}" in - '') - case "${prev}" in - -s) - # Use 'fastboot devices' to list serial numbers. - COMPREPLY=( $(compgen -W "$(fastboot devices|cut -f1)" -- ${cur} ) ) - return 0 - ;; - esac - case "${cur}" in - -*) - COMPREPLY=( $(compgen -W "$opts" -- ${cur}) ) - return 0 - ;; - esac - if [ -z "$device_selected" ]; then - local num_devices=$(( $(fastboot devices 2>/dev/null|wc -l) )) - if [ "$num_devices" -gt "1" ]; then - # With multiple devices, you must choose a device first. - COMPREPLY=( $(compgen -W "-s" -- ${cur}) ) - return 0 - fi - fi - COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) ) - return 0 - ;; - flash) - # partition name - COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) ) - return 0 - ;; - erase) - # partition name - COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) ) - return 0 - ;; - esac -} -complete -o default -F _fastboot fastboot diff --git a/bash_completion.fastboot b/bash_completion.fastboot new file mode 100644 index 0000000..bc59ee8 --- /dev/null +++ b/bash_completion.fastboot @@ -0,0 +1,90 @@ +## Bash completion for the Android SDK tools. +## +## Copyright (c) 2009 Matt Brubeck +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to deal +## in the Software without restriction, including without limitation the rights +## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +## copies of the Software, and to permit persons to whom the Software is +## furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be included in +## all copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +## THE SOFTWARE. + + +function _fastboot() +{ + local cur prev opts cmds c subcommand device_selected + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-w -s -p -c -i -b -n" + cmds="update flashall flash erase getvar boot devices \ + reboot reboot-bootloader oem continue" + subcommand="" + partition_list="boot recovery system userdata bootloader radio" + device_selected="" + + # Look for the subcommand. + c=1 + while [ $c -lt $COMP_CWORD ]; do + word="${COMP_WORDS[c]}" + if [ "$word" = "-s" ]; then + device_selected=true + fi + for cmd in $cmds; do + if [ "$cmd" = "$word" ]; then + subcommand="$word" + fi + done + c=$((++c)) + done + + case "${subcommand}" in + '') + case "${prev}" in + -s) + # Use 'fastboot devices' to list serial numbers. + COMPREPLY=( $(compgen -W "$(fastboot devices|cut -f1)" -- ${cur} ) ) + return 0 + ;; + esac + case "${cur}" in + -*) + COMPREPLY=( $(compgen -W "$opts" -- ${cur}) ) + return 0 + ;; + esac + if [ -z "$device_selected" ]; then + local num_devices=$(( $(fastboot devices 2>/dev/null|wc -l) )) + if [ "$num_devices" -gt "1" ]; then + # With multiple devices, you must choose a device first. + COMPREPLY=( $(compgen -W "-s" -- ${cur}) ) + return 0 + fi + fi + COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) ) + return 0 + ;; + flash) + # partition name + COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) ) + return 0 + ;; + erase) + # partition name + COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) ) + return 0 + ;; + esac +} +complete -o default -F _fastboot fastboot