Do not remove paths containing ./ or ../ (#162)
This commit is contained in:
parent
6f699fbfc1
commit
06a3597afe
|
@ -337,7 +337,7 @@ function _roscomplete_sub_dir {
|
|||
unset IFS
|
||||
else
|
||||
if [ -e ${rosvals[1]}${rosvals[2]} ]; then
|
||||
opts=`find -L ${rosvals[1]}${rosvals[2]} -maxdepth 1 -mindepth 1 -type d ! -regex ".*/[.].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1\//g"`
|
||||
opts=`find -L ${rosvals[1]}${rosvals[2]} -maxdepth 1 -mindepth 1 -type d ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1\//g"`
|
||||
else
|
||||
opts=''
|
||||
fi
|
||||
|
@ -369,7 +369,7 @@ function _msg_opts {
|
|||
else
|
||||
path=`rospack find ${pkgname}`
|
||||
if [ -d ${path}/msg ]; then
|
||||
echo `find -L ${path}/msg -maxdepth 1 -mindepth 1 -name *.msg ! -regex ".*/[.].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.msg/${pkgname}\/\1/g"`
|
||||
echo `find -L ${path}/msg -maxdepth 1 -mindepth 1 -name *.msg ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.msg/${pkgname}\/\1/g"`
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ function _srv_opts {
|
|||
path=`rospack find ${pkgname} 2> /dev/null`
|
||||
|
||||
if [ $? -eq 0 ] && [ -d ${path}/srv ]; then
|
||||
echo `find -L ${path}/srv -maxdepth 1 -mindepth 1 -name *.srv ! -regex ".*/[.].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.srv/${pkgname}\/\1/g"`
|
||||
echo `find -L ${path}/srv -maxdepth 1 -mindepth 1 -name *.srv ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.srv/${pkgname}\/\1/g"`
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ function _roscomplete_find {
|
|||
fi
|
||||
pkgdir=`_ros_package_find ${pkg}`
|
||||
if [[ -n "$catkin_package_libexec_dir" || -n "$pkgdir" ]]; then
|
||||
opts=`_rosfind -L $catkin_package_libexec_dir "$pkgdir" ${1} ! -regex ".*/[.].*" ! -regex ".*$pkgdir\/build\/.*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1/g"`
|
||||
opts=`_rosfind -L $catkin_package_libexec_dir "$pkgdir" ${1} ! -regex ".*/[.][^./].*" ! -regex ".*$pkgdir\/build\/.*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1/g"`
|
||||
else
|
||||
opts=""
|
||||
fi
|
||||
|
@ -484,7 +484,7 @@ function _roscomplete_search_dir {
|
|||
path=.
|
||||
fi
|
||||
if [[ -e ${path} ]]; then
|
||||
opts=`find -L $path -maxdepth 1 -type d ! -regex ".*/[.].*" ! -regex "^[.]/" -print0 | tr '\000' '\n' | sed -e "s/$/\//g" -e "s/^[.]\///g" -e "s/'/\\\\\'/g" -e "s/ /\\\\\ /g"`$'\n'`find -L $path -maxdepth 1 -type f ! -regex ".*/[.][^.]*" ! -regex "^[.]/" -print0 | tr '\000' '\n' | sed -e "s/^[.]\///g" -e "s/'/\\\\\'/g" -e "s/ /\\\\\ /g"`
|
||||
opts=`find -L $path -maxdepth 1 -type d ! -regex ".*/[.][^./].*" ! -regex "^[.]/" -print0 | tr '\000' '\n' | sed -e "s/$/\//g" -e "s/^[.]\///g" -e "s/'/\\\\\'/g" -e "s/ /\\\\\ /g"`$'\n'`find -L $path -maxdepth 1 -type f ! -regex ".*/[.][^.]*" ! -regex "^[.]/" -print0 | tr '\000' '\n' | sed -e "s/^[.]\///g" -e "s/'/\\\\\'/g" -e "s/ /\\\\\ /g"`
|
||||
else
|
||||
opts=""
|
||||
fi
|
||||
|
@ -494,7 +494,7 @@ function _roscomplete_search_dir {
|
|||
if [[ ${#COMPREPLY[*]} = 1 ]]; then
|
||||
newpath=${COMPREPLY[0]%/*}
|
||||
if [[ -d ${newpath} ]]; then
|
||||
opts=`find -L $newpath -maxdepth 1 -type d ! -regex ".*/[.].*" ! -regex "^[.]/" -print0 | tr '\000' '\n' | sed -e "s/$/\//g" -e "s/^[.]\///g" -e "s/'/\\\\\'/g" -e "s/ /\\\\\ /g"`$'\n'`find -L $newpath -maxdepth 1 -type f ! -regex ".*/[.][^.]*" ! -regex "^[.]/" -print0 | tr '\000' '\n' | sed -e "s/^[.]\///g" -e "s/'/\\\\\'/g" -e "s/ /\\\\\ /g"`
|
||||
opts=`find -L $newpath -maxdepth 1 -type d ! -regex ".*/[.][^./].*" ! -regex "^[.]/" -print0 | tr '\000' '\n' | sed -e "s/$/\//g" -e "s/^[.]\///g" -e "s/'/\\\\\'/g" -e "s/ /\\\\\ /g"`$'\n'`find -L $newpath -maxdepth 1 -type f ! -regex ".*/[.][^.]*" ! -regex "^[.]/" -print0 | tr '\000' '\n' | sed -e "s/^[.]\///g" -e "s/'/\\\\\'/g" -e "s/ /\\\\\ /g"`
|
||||
IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
||||
unset IFS
|
||||
|
@ -885,7 +885,7 @@ function _msg_opts {
|
|||
path=`rospack find ${pkgname} 2> /dev/null`
|
||||
|
||||
if [ $? -eq 0 ] && [ -d ${path}/msg ]; then
|
||||
echo `find -L ${path}/msg -maxdepth 1 -mindepth 1 -name *.msg ! -regex ".*/[.].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.msg/${pkgname}\/\1/g"`
|
||||
echo `find -L ${path}/msg -maxdepth 1 -mindepth 1 -name *.msg ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.msg/${pkgname}\/\1/g"`
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue