zsh: add cogrep function

This commit is contained in:
Mathieu Maret 2018-01-04 11:03:02 +01:00
parent 46d4768f64
commit b48e734f84
1 changed files with 12 additions and 1 deletions

View File

@ -102,6 +102,17 @@ cgrep () {
find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) -print0 | xargs -0 grep --color -n "$@"
}
# Echo NULL separeted file if they exist
displayExist(){
while IFS= read -r -d '' f; do
test -e "$f" && echo -n $f'\0'
done
}
cogrep () {
find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.o' \) -print0 | sed 's/.o\x0/.c\x0/g'| displayExist | xargs -0 grep --color -n "$@"
}
jgrep () {
find . -name .repo -prune -o -name .git -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
}
@ -218,7 +229,7 @@ sdocker (){
img=$(docker ps -a | grep $1 | awk '{print $1}' | head -1);
if [ -z $img ]; then
echo "Running a new container"
docker run ${AOSP_ARGS} ${=SSH_AUTH_ARGS} -v ${AOSP_IMAGE}:/aosp/Project --user="$(id -u):$(id -g)" $1
docker run ${AOSP_ARGS} ${=SSH_AUTH_ARGS} -v ${AOSP_IMAGE}:/aosp/Project -v /media/mmaret/data_wd:/aosp/data_wd -v /media/mmaret/data:/aosp/data --user="$(id -u):$(id -g)" $1
else
echo "Starting $img"
docker start -i -a $img