v01
This commit is contained in:
42
thirdparty/ros/ros_comm/tools/topic_tools/env-hooks/20.transform.bash
vendored
Normal file
42
thirdparty/ros/ros_comm/tools/topic_tools/env-hooks/20.transform.bash
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
function _roscomplete_node_transform
|
||||
{
|
||||
local arg opts
|
||||
COMPREPLY=()
|
||||
arg="${COMP_WORDS[COMP_CWORD]}"
|
||||
local cword=$COMP_CWORD
|
||||
for a in $(seq $((COMP_CWORD-1))); do
|
||||
if [ -z "${COMP_WORDS[a]//-*}" ]; then
|
||||
((cword--))
|
||||
fi
|
||||
done
|
||||
local words=(${COMP_WORDS[@]//-*})
|
||||
|
||||
if [[ $cword == 3 ]]; then
|
||||
opts=`rostopic list 2> /dev/null`
|
||||
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
||||
elif [[ $cword == 5 ]]; then
|
||||
opts=`rosmsg list 2> /dev/null`
|
||||
COMPREPLY=($(compgen -W "$opts" -- ${arg}))
|
||||
fi
|
||||
}
|
||||
|
||||
_sav_transform_roscomplete_rosrun=$(complete | grep -w rosrun | awk '{print $3}')
|
||||
|
||||
function is_transform_node
|
||||
{
|
||||
local words=(${COMP_WORDS[@]//-*})
|
||||
[ ${#words[@]} -gt 2 ] && \
|
||||
[ "${words[1]}" = "topic_tools" ] && \
|
||||
[ "${words[2]}" = "transform" ]
|
||||
}
|
||||
|
||||
function _roscomplete_rosrun_transform
|
||||
{
|
||||
if is_transform_node; then
|
||||
_roscomplete_node_transform
|
||||
else
|
||||
eval "$_sav_transform_roscomplete_rosrun"
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F "_roscomplete_rosrun_transform" "rosrun"
|
||||
Reference in New Issue
Block a user