Merge "Tab completion for the croot function"

am: 5cbb363305

Change-Id: Ia1b45a7a278efba54ce8bf6246d4e9fa8019fee3
This commit is contained in:
Anton Hansson
2019-02-11 02:21:25 -08:00
committed by android-build-merger

View File

@@ -9,7 +9,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
build, and stores those selections in the environment to be read by subsequent
invocations of 'm' etc.
- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user]
- croot: Changes directory to the top of the tree.
- croot: Changes directory to the top of the tree, or a subdirectory thereof.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory, but not their dependencies.
- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
@@ -370,6 +370,10 @@ function addcompletions()
if should_add_completion bit ; then
complete -C "bit --tab" bit
fi
if [ -z "$ZSH_VERSION" ]; then
# Doesn't work in zsh.
complete -o nospace -F _croot croot
fi
complete -F _lunch lunch
complete -F _complete_android_module_names gomod
@@ -985,6 +989,18 @@ function croot()
fi
}
function _croot()
{
local T=$(gettop)
if [ "$T" ]; then
local cur="${COMP_WORDS[COMP_CWORD]}"
k=0
for c in $(compgen -d ${T}/${cur}); do
COMPREPLY[k++]=${c#${T}/}/
done
fi
}
function cproj()
{
local TOPFILE=build/make/core/envsetup.mk