3 | 3 |
# COMPREPLY is the var used by bash complete builtin
|
4 | 4 |
|
5 | 5 |
function _rossed {
|
6 | |
if [[ `uname` == Darwin || `uname` == FreeBSD ]]; then
|
|
6 |
if [[ $(uname) == Darwin || $(uname) == FreeBSD ]]; then
|
7 | 7 |
sed -E "$@"
|
8 | 8 |
else
|
9 | 9 |
sed -r "$@"
|
|
11 | 11 |
}
|
12 | 12 |
|
13 | 13 |
function _rosfind {
|
14 | |
if [[ `uname` == Darwin || `uname` == FreeBSD ]]; then
|
|
14 |
if [[ $(uname) == Darwin || $(uname) == FreeBSD ]]; then
|
15 | 15 |
# BSD find needs -E for extended regexp
|
16 | 16 |
find -E "$@"
|
17 | 17 |
else
|
|
26 | 26 |
# stack echoes its result
|
27 | 27 |
function _ros_location_find {
|
28 | 28 |
local ROS_LOCATION_KEYS_ARR ROS_LOCATIONS_ARR loc
|
29 | |
ROS_LOCATION_KEYS_ARR=(`echo $ROS_LOCATIONS | _rossed -e 's/([^:=]*)=([^:=]*)(:*[^=])*(:|$)/\1 /g'`)
|
30 | |
ROS_LOCATIONS_ARR=(`echo $ROS_LOCATIONS | _rossed -e 's/([^:=]*)=([^:=]*)(:*[^=])*(:|$)/\2 /g' -e "s|~|$HOME|g"`)
|
|
29 |
ROS_LOCATION_KEYS_ARR=($(echo $ROS_LOCATIONS | _rossed -e 's/([^:=]*)=([^:=]*)(:*[^=])*(:|$)/\1 /g'))
|
|
30 |
ROS_LOCATIONS_ARR=($(echo $ROS_LOCATIONS | _rossed -e 's/([^:=]*)=([^:=]*)(:*[^=])*(:|$)/\2 /g' -e "s|~|$HOME|g"))
|
31 | 31 |
|
32 | 32 |
for (( i = 0 ; i < ${#ROS_LOCATION_KEYS_ARR[@]} ; i++ )); do
|
33 | 33 |
if [[ $1 == ${ROS_LOCATION_KEYS_ARR[$i]} ]]; then
|
|
37 | 37 |
done
|
38 | 38 |
|
39 | 39 |
if [[ $1 == log ]]; then
|
40 | |
echo `roslaunch-logs`
|
|
40 |
echo $(roslaunch-logs)
|
41 | 41 |
return 0
|
42 | 42 |
elif [[ $1 == test_results ]]; then
|
43 | |
echo `rosrun rosunit test_results_dir.py`
|
|
43 |
echo $(rosrun rosunit test_results_dir.py)
|
44 | 44 |
return 0
|
45 | 45 |
fi
|
46 | 46 |
|
47 | |
loc=`export ROS_CACHE_TIMEOUT=-1.0 && rospack find $1 2> /dev/null`
|
|
47 |
loc=$(export ROS_CACHE_TIMEOUT=-1.0 && rospack find $1 2> /dev/null)
|
48 | 48 |
if [[ $? != 0 ]]; then
|
49 | |
loc=`export ROS_CACHE_TIMEOUT=-1.0 && rosstack find $1 2> /dev/null`
|
|
49 |
loc=$(export ROS_CACHE_TIMEOUT=-1.0 && rosstack find $1 2> /dev/null)
|
50 | 50 |
if [[ $? != 0 ]]; then
|
51 | 51 |
return 1
|
52 | 52 |
fi
|
|
59 | 59 |
|
60 | 60 |
function _ros_list_locations {
|
61 | 61 |
local ROS_LOCATION_KEYS packages stacks
|
62 | |
ROS_LOCATION_KEYS=`echo $ROS_LOCATIONS | _rossed -e 's/([^:=]*)=([^:=]*)(:*[^=])*(:|$)/\1 /g'`
|
63 | |
packages=`export ROS_CACHE_TIMEOUT=-1.0 && rospack list-names`
|
64 | |
stacks=`export ROS_CACHE_TIMEOUT=-1.0 && rosstack list-names`
|
|
62 |
ROS_LOCATION_KEYS=$(echo $ROS_LOCATIONS | _rossed -e 's/([^:=]*)=([^:=]*)(:*[^=])*(:|$)/\1 /g')
|
|
63 |
packages=$(export ROS_CACHE_TIMEOUT=-1.0 && rospack list-names)
|
|
64 |
stacks=$(export ROS_CACHE_TIMEOUT=-1.0 && rosstack list-names)
|
65 | 65 |
echo $packages $stacks log test_results $ROS_LOCATION_KEYS | tr ' ' '\n'
|
66 | 66 |
return 0
|
67 | 67 |
}
|
68 | 68 |
|
69 | 69 |
function _ros_package_find {
|
70 | 70 |
local loc
|
71 | |
loc=`export ROS_CACHE_TIMEOUT=-1.0 && rospack find $1 2> /dev/null`
|
|
71 |
loc=$(export ROS_CACHE_TIMEOUT=-1.0 && rospack find $1 2> /dev/null)
|
72 | 72 |
if [[ $? != 0 ]]; then
|
73 | 73 |
return 1
|
74 | 74 |
fi
|
|
78 | 78 |
|
79 | 79 |
function _ros_list_packages {
|
80 | 80 |
local packages
|
81 | |
packages=`export ROS_CACHE_TIMEOUT=-1.0 && rospack list-names`
|
|
81 |
packages=$(export ROS_CACHE_TIMEOUT=-1.0 && rospack list-names)
|
82 | 82 |
echo $packages | tr ' ' '\n'
|
83 | 83 |
return 0
|
84 | 84 |
}
|
85 | 85 |
|
86 | 86 |
function _ros_list_stacks {
|
87 | 87 |
local stacks
|
88 | |
stacks=`export ROS_CACHE_TIMEOUT=-1.0 && rosstack list-names`
|
|
88 |
stacks=$(export ROS_CACHE_TIMEOUT=-1.0 && rosstack list-names)
|
89 | 89 |
echo $stacks | tr ' ' '\n'
|
90 | 90 |
return 0
|
91 | 91 |
}
|
|
113 | 113 |
fi
|
114 | 114 |
fi
|
115 | 115 |
|
116 | |
rosdir=`_ros_location_find $rosname`
|
|
116 |
rosdir=$(_ros_location_find $rosname)
|
117 | 117 |
if [[ $? != 0 ]]; then
|
118 | 118 |
rosvals=(${rosname})
|
119 | 119 |
return 1
|
|
130 | 130 |
fi
|
131 | 131 |
if [[ -z $1 ]]; then
|
132 | 132 |
if [[ -f ./manifest.xml ]]; then
|
133 | |
pkgname=`basename \`pwd\``
|
|
133 |
pkgname=$(basename $(pwd))
|
134 | 134 |
python -i -c "import roslib; roslib.load_manifest('$pkgname')"
|
135 | 135 |
else
|
136 | 136 |
python
|
|
192 | 192 |
return 0
|
193 | 193 |
fi
|
194 | 194 |
let count=0;
|
195 | |
for items in `dirs`;
|
|
195 |
for items in $(dirs);
|
196 | 196 |
do
|
197 | 197 |
echo $count $items;
|
198 | 198 |
let count=$((count+1));
|
|
232 | 232 |
function _roscmd {
|
233 | 233 |
local pkgdir exepath opt catkin_package_libexec_dir opts
|
234 | 234 |
if [[ -n $CMAKE_PREFIX_PATH ]]; then
|
235 | |
catkin_package_libexec_dir=`catkin_find --first-only --without-underlays --libexec $1 2> /dev/null`
|
236 | |
fi
|
237 | |
pkgdir=`_ros_package_find $1`
|
|
235 |
catkin_package_libexec_dir=$(catkin_find --first-only --without-underlays --libexec $1 2> /dev/null)
|
|
236 |
fi
|
|
237 |
pkgdir=$(_ros_package_find $1)
|
238 | 238 |
if [[ -z $catkin_package_libexec_dir && -z $pkgdir ]]; then
|
239 | 239 |
echo "Couldn't find package [$1]"
|
240 | 240 |
return 1
|
241 | 241 |
fi
|
242 | |
exepath=(`find -L $catkin_package_libexec_dir $pkgdir -name $2 -type f ! -regex .*/[.].* ! -regex .*$pkgdir\/build\/.* | uniq`)
|
|
242 |
exepath=($(find -L $catkin_package_libexec_dir $pkgdir -name $2 -type f ! -regex .*/[.].* ! -regex .*$pkgdir\/build\/.* | uniq))
|
243 | 243 |
if [[ ${#exepath[@]} == 0 ]] ; then
|
244 | 244 |
echo "That file does not exist in that package."
|
245 | 245 |
return 1
|
|
308 | 308 |
local arg opts
|
309 | 309 |
COMPREPLY=()
|
310 | 310 |
arg="${COMP_WORDS[COMP_CWORD]}"
|
311 | |
opts="`_ros_list_packages` `_ros_list_stacks`"
|
|
311 |
opts="$(_ros_list_packages) $(_ros_list_stacks)"
|
312 | 312 |
IFS=$'\n'
|
313 | 313 |
COMPREPLY=($(compgen -W "${opts}" -- ${arg}))
|
314 | 314 |
unset IFS
|
|
330 | 330 |
arg="${COMP_WORDS[COMP_CWORD]}"
|
331 | 331 |
_ros_decode_path ${arg}
|
332 | 332 |
if [[ -z ${rosvals[2]} ]]; then
|
333 | |
opts=`_ros_list_locations`
|
|
333 |
opts=$(_ros_list_locations)
|
334 | 334 |
IFS=$'\n'
|
335 | 335 |
COMPREPLY=($(compgen -W "${opts}" -S / -- ${rosvals[0]}))
|
336 | 336 |
unset IFS
|
337 | 337 |
else
|
338 | 338 |
if [ -e ${rosvals[1]}${rosvals[2]} ]; then
|
339 | |
opts=`find -L ${rosvals[1]}${rosvals[2]} -maxdepth 1 -mindepth 1 -type d ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1\//g"`
|
|
339 |
opts=$(find -L ${rosvals[1]}${rosvals[2]} -maxdepth 1 -mindepth 1 -type d ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1\//g")
|
340 | 340 |
else
|
341 | 341 |
opts=''
|
342 | 342 |
fi
|
|
358 | 358 |
fi
|
359 | 359 |
|
360 | 360 |
if [[ -z ${searchmsg} ]]; then
|
361 | |
pkgs=(`rospack list`)
|
|
361 |
pkgs=($(rospack list))
|
362 | 362 |
|
363 | 363 |
for (( i = 0 ; i < ${#pkgs[@]} ; i=i+2 )); do
|
364 | 364 |
if [[ -d ${pkgs[i+1]}/msg ]]; then
|
|
366 | 366 |
fi
|
367 | 367 |
done
|
368 | 368 |
else
|
369 | |
path=`rospack find ${pkgname}`
|
|
369 |
path=$(rospack find ${pkgname})
|
370 | 370 |
if [ -d ${path}/msg ]; then
|
371 | |
echo `find -L ${path}/msg -maxdepth 1 -mindepth 1 -name *.msg ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.msg/${pkgname}\/\1/g"`
|
|
371 |
echo $(find -L ${path}/msg -maxdepth 1 -mindepth 1 -name *.msg ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.msg/${pkgname}\/\1/g")
|
372 | 372 |
fi
|
373 | 373 |
fi
|
374 | 374 |
}
|
|
385 | 385 |
fi
|
386 | 386 |
|
387 | 387 |
if [[ -z ${searchsrv} ]]; then
|
388 | |
pkgs=(`rospack list | grep "^${pkgname}"`)
|
|
388 |
pkgs=($(rospack list | grep "^${pkgname}"))
|
389 | 389 |
count=0
|
390 | 390 |
|
391 | 391 |
opts=""
|
|
404 | 404 |
fi
|
405 | 405 |
fi
|
406 | 406 |
|
407 | |
path=`rospack find ${pkgname} 2> /dev/null`
|
|
407 |
path=$(rospack find ${pkgname} 2> /dev/null)
|
408 | 408 |
|
409 | 409 |
if [ $? -eq 0 ] && [ -d ${path}/srv ]; then
|
410 | |
echo `find -L ${path}/srv -maxdepth 1 -mindepth 1 -name *.srv ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.srv/${pkgname}\/\1/g"`
|
|
410 |
echo $(find -L ${path}/srv -maxdepth 1 -mindepth 1 -name *.srv ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.srv/${pkgname}\/\1/g")
|
411 | 411 |
fi
|
412 | 412 |
}
|
413 | 413 |
|
|
421 | 421 |
elif [[ $COMP_CWORD == 2 ]]; then
|
422 | 422 |
case ${COMP_WORDS[1]} in
|
423 | 423 |
show|users|md5)
|
424 | |
opts=`_srv_opts ${COMP_WORDS[$COMP_CWORD]}`
|
|
424 |
opts=$(_srv_opts ${COMP_WORDS[$COMP_CWORD]})
|
425 | 425 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
426 | 426 |
;;
|
427 | 427 |
package)
|
428 | |
opts=`rospack list-names`
|
|
428 |
opts=$(rospack list-names)
|
429 | 429 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
430 | 430 |
;;
|
431 | 431 |
packages|list)
|
|
438 | 438 |
function _roscomplete_pkg {
|
439 | 439 |
# complete package names that start with $1
|
440 | 440 |
local arg=${1}
|
441 | |
local opts=`_ros_list_packages`
|
|
441 |
local opts=$(_ros_list_packages)
|
442 | 442 |
IFS=$'\n'
|
443 | 443 |
COMPREPLY=($(compgen -W "${opts}" -- ${arg}))
|
444 | 444 |
unset IFS
|
|
451 | 451 |
local pkg=${2}
|
452 | 452 |
local arg=${3}
|
453 | 453 |
if [[ -n $CMAKE_PREFIX_PATH ]]; then
|
454 | |
catkin_package_libexec_dir=`catkin_find --first-only --without-underlays --libexec ${pkg} 2> /dev/null`
|
455 | |
fi
|
456 | |
pkgdir=`_ros_package_find ${pkg}`
|
|
454 |
catkin_package_libexec_dir=$(catkin_find --first-only --without-underlays --libexec ${pkg} 2> /dev/null)
|
|
455 |
fi
|
|
456 |
pkgdir=$(_ros_package_find ${pkg})
|
457 | 457 |
if [[ -n "$catkin_package_libexec_dir" || -n "$pkgdir" ]]; then
|
458 | |
opts=`_rosfind -L $catkin_package_libexec_dir "$pkgdir" ${1} ! -regex ".*/[.][^./].*" ! -regex ".*$pkgdir\/build\/.*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1/g"`
|
|
458 |
opts=$(_rosfind -L $catkin_package_libexec_dir "$pkgdir" ${1} ! -regex ".*/[.][^./].*" ! -regex ".*$pkgdir\/build\/.*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1/g")
|
459 | 459 |
else
|
460 | 460 |
opts=""
|
461 | 461 |
fi
|
|
476 | 476 |
_roscomplete_find "${1}" "${COMP_WORDS[1]}" "${arg}"
|
477 | 477 |
else
|
478 | 478 |
# complete filenames
|
479 | |
arg=`echo ${arg} | sed -e "s|~|$HOME|g"`
|
|
479 |
arg=$(echo ${arg} | sed -e "s|~|$HOME|g")
|
480 | 480 |
if [[ $arg =~ ^/*.+/.* ]]; then
|
481 | 481 |
path=${arg%/*}
|
482 | 482 |
else
|
483 | 483 |
path=.
|
484 | 484 |
fi
|
485 | 485 |
if [[ -e ${path} ]]; then
|
486 | |
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"`
|
|
486 |
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")
|
487 | 487 |
else
|
488 | 488 |
opts=""
|
489 | 489 |
fi
|
|
493 | 493 |
if [[ ${#COMPREPLY[*]} = 1 ]]; then
|
494 | 494 |
newpath=${COMPREPLY[0]%/*}
|
495 | 495 |
if [[ -d ${newpath} ]]; then
|
496 | |
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"`
|
|
496 |
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")
|
497 | 497 |
IFS=$'\n'
|
498 | 498 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
499 | 499 |
unset IFS
|
|
505 | 505 |
|
506 | 506 |
function _roscomplete_exe {
|
507 | 507 |
local perm i prev_arg
|
508 | |
if [[ `uname` == Darwin ]]; then
|
|
508 |
if [[ $(uname) == Darwin ]]; then
|
509 | 509 |
perm="+111"
|
510 | 510 |
else
|
511 | 511 |
perm="/111"
|
|
660 | 660 |
opts="help find list list-names list-duplicates langs depends depends-manifests depends1 depends-indent depends-msgsrv depends-why rosdep rosdep0 vcs vcs0 depends-on depends-on1 export plugins cflags-only-I cflags-only-other libs-only-L libs-only-l libs-only-other profile"
|
661 | 661 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
662 | 662 |
else
|
663 | |
opts=`rospack list-names`
|
|
663 |
opts=$(rospack list-names)
|
664 | 664 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
665 | 665 |
fi
|
666 | 666 |
|
|
677 | 677 |
elif [[ $COMP_CWORD == 2 ]]; then
|
678 | 678 |
case ${COMP_WORDS[1]} in
|
679 | 679 |
info)
|
680 | |
opts=`rosnode list 2> /dev/null`
|
|
680 |
opts=$(rosnode list 2> /dev/null)
|
681 | 681 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
682 | 682 |
;;
|
683 | 683 |
ping|list|kill)
|
684 | 684 |
if [[ ${arg} =~ \-\-.* ]]; then
|
685 | 685 |
opts="--all --help"
|
686 | 686 |
else
|
687 | |
opts=`rosnode list 2> /dev/null`
|
|
687 |
opts=$(rosnode list 2> /dev/null)
|
688 | 688 |
fi
|
689 | 689 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
690 | 690 |
;;
|
|
696 | 696 |
case ${COMP_WORDS[1]} in
|
697 | 697 |
kill)
|
698 | 698 |
# complete on node name
|
699 | |
opts=`rosnode list 2> /dev/null`
|
|
699 |
opts=$(rosnode list 2> /dev/null)
|
700 | 700 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
701 | 701 |
;;
|
702 | 702 |
esac
|
|
714 | 714 |
elif [[ $COMP_CWORD == 2 ]]; then
|
715 | 715 |
case ${COMP_WORDS[1]} in
|
716 | 716 |
set|get|delete|list)
|
717 | |
opts=`rosparam list 2> /dev/null`
|
|
717 |
opts=$(rosparam list 2> /dev/null)
|
718 | 718 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
719 | 719 |
;;
|
720 | 720 |
load|dump)
|
|
726 | 726 |
case ${COMP_WORDS[1]} in
|
727 | 727 |
load|dump)
|
728 | 728 |
# complete on namespace
|
729 | |
opts=`rosparam list 2> /dev/null`
|
|
729 |
opts=$(rosparam list 2> /dev/null)
|
730 | 730 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
731 | 731 |
;;
|
732 | 732 |
esac
|
|
766 | 766 |
if [[ ${COMP_WORDS[$(( $COMP_CWORD - 1 ))]} == "-b" ]]; then
|
767 | 767 |
COMPREPLY=($(compgen -f -- ${arg}))
|
768 | 768 |
else
|
769 | |
opts=`rostopic list 2> /dev/null`
|
|
769 |
opts=$(rostopic list 2> /dev/null)
|
770 | 770 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
771 | 771 |
fi
|
772 | 772 |
;;
|
773 | 773 |
find)
|
774 | |
opts=`_msg_opts ${COMP_WORDS[$COMP_CWORD]}`
|
|
774 |
opts=$(_msg_opts ${COMP_WORDS[$COMP_CWORD]})
|
775 | 775 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
776 | 776 |
;;
|
777 | 777 |
pub)
|
|
796 | 796 |
fi
|
797 | 797 |
done
|
798 | 798 |
if [[ $COMP_CWORD == $topic_pos ]]; then
|
799 | |
opts=`rostopic list 2> /dev/null`
|
|
799 |
opts=$(rostopic list 2> /dev/null)
|
800 | 800 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
801 | 801 |
elif [[ $COMP_CWORD == $type_pos ]]; then
|
802 | 802 |
opts=$(rostopic info ${COMP_WORDS[$COMP_CWORD-1]} 2> /dev/null | awk '/Type:/{print $2}')
|
803 | 803 |
if [ -z "$opts" ]; then
|
804 | |
opts=`_msg_opts ${COMP_WORDS[$COMP_CWORD]}`
|
|
804 |
opts=$(_msg_opts ${COMP_WORDS[$COMP_CWORD]})
|
805 | 805 |
fi
|
806 | 806 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
807 | 807 |
elif [[ $COMP_CWORD == $msg_pos ]]; then
|
808 | |
opts=`rosmsg-proto msg 2> /dev/null -s ${COMP_WORDS[$COMP_CWORD - 1]}`
|
|
808 |
opts=$(rosmsg-proto msg 2> /dev/null -s ${COMP_WORDS[$COMP_CWORD - 1]})
|
809 | 809 |
if [ 0 -eq $? ]; then
|
810 | 810 |
COMPREPLY="$opts"
|
811 | 811 |
fi
|
|
827 | 827 |
elif [[ $COMP_CWORD == 2 ]]; then
|
828 | 828 |
case ${COMP_WORDS[1]} in
|
829 | 829 |
args|call|info|list|type|uri)
|
830 | |
opts=`rosservice list 2> /dev/null`
|
|
830 |
opts=$(rosservice list 2> /dev/null)
|
831 | 831 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
832 | 832 |
;;
|
833 | 833 |
find)
|
834 | 834 |
# Need a clever way to do message searching
|
835 | |
opts=`_srv_opts ${COMP_WORDS[$COMP_CWORD]}`
|
|
835 |
opts=$(_srv_opts ${COMP_WORDS[$COMP_CWORD]})
|
836 | 836 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
837 | 837 |
;;
|
838 | 838 |
esac
|
839 | 839 |
elif [[ $COMP_CWORD == 3 ]]; then
|
840 | 840 |
case ${COMP_WORDS[1]} in
|
841 | 841 |
call)
|
842 | |
type=`rosservice type ${COMP_WORDS[2]}`
|
843 | |
opts=`rosmsg-proto srv 2> /dev/null -s ${type}`
|
|
842 |
type=$(rosservice type ${COMP_WORDS[2]})
|
|
843 |
opts=$(rosmsg-proto srv 2> /dev/null -s ${type})
|
844 | 844 |
if [ 0 -eq $? ]; then
|
845 | 845 |
COMPREPLY="$opts"
|
846 | 846 |
fi
|
|
862 | 862 |
fi
|
863 | 863 |
|
864 | 864 |
if [[ -z ${searchmsg} ]]; then
|
865 | |
pkgs=(`rospack list | grep "^${pkgname}"`)
|
|
865 |
pkgs=($(rospack list | grep "^${pkgname}"))
|
866 | 866 |
count=0
|
867 | 867 |
|
868 | 868 |
opts=""
|
|
881 | 881 |
fi
|
882 | 882 |
fi
|
883 | 883 |
|
884 | |
path=`rospack find ${pkgname} 2> /dev/null`
|
|
884 |
path=$(rospack find ${pkgname} 2> /dev/null)
|
885 | 885 |
|
886 | 886 |
if [ $? -eq 0 ] && [ -d ${path}/msg ]; then
|
887 | |
echo `find -L ${path}/msg -maxdepth 1 -mindepth 1 -name *.msg ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.msg/${pkgname}\/\1/g"`
|
|
887 |
echo $(find -L ${path}/msg -maxdepth 1 -mindepth 1 -name *.msg ! -regex ".*/[.][^./].*" -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)\.msg/${pkgname}\/\1/g")
|
888 | 888 |
fi
|
889 | 889 |
}
|
890 | 890 |
|
|
899 | 899 |
elif [[ $COMP_CWORD == 2 ]]; then
|
900 | 900 |
case ${COMP_WORDS[1]} in
|
901 | 901 |
show|info|users|md5)
|
902 | |
opts=`_msg_opts ${COMP_WORDS[$COMP_CWORD]}`
|
|
902 |
opts=$(_msg_opts ${COMP_WORDS[$COMP_CWORD]})
|
903 | 903 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
904 | 904 |
;;
|
905 | 905 |
package)
|
906 | |
opts=`rospack list-names`
|
|
906 |
opts=$(rospack list-names)
|
907 | 907 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
908 | 908 |
;;
|
909 | 909 |
packages|list)
|
|
920 | 920 |
arg="${COMP_WORDS[COMP_CWORD]}"
|
921 | 921 |
|
922 | 922 |
if [[ $COMP_CWORD != 1 ]]; then
|
923 | |
opts=`rospack list-names`
|
|
923 |
opts=$(rospack list-names)
|
924 | 924 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
925 | 925 |
fi
|
926 | 926 |
}
|
|
959 | 959 |
elif [[ $COMP_CWORD == 2 ]]; then
|
960 | 960 |
case ${COMP_WORDS[1]} in
|
961 | 961 |
get|set|list)
|
962 | |
opts=`rosnode list 2> /dev/null`
|
|
962 |
opts=$(rosnode list 2> /dev/null)
|
963 | 963 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
964 | 964 |
;;
|
965 | 965 |
esac
|
966 | 966 |
elif [[ $COMP_CWORD == 3 ]]; then
|
967 | 967 |
case ${COMP_WORDS[1]} in
|
968 | 968 |
get|set)
|
969 | |
opts=`rosconsole list ${COMP_WORDS[2]} 2> /dev/null`
|
|
969 |
opts=$(rosconsole list ${COMP_WORDS[2]} 2> /dev/null)
|
970 | 970 |
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
971 | 971 |
;;
|
972 | 972 |
esac
|