From f9eef419890b07067936db71ed7daf41ae511d68 Mon Sep 17 00:00:00 2001 From: Ken Conley Date: Fri, 18 Dec 2009 05:26:41 +0000 Subject: [PATCH] rosbash: more tab complete awesome for rosservice, rostopic, rosparam based on leibs' template --- tools/rosbash/rosbash | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/tools/rosbash/rosbash b/tools/rosbash/rosbash index cb98e5e8..7936bd94 100644 --- a/tools/rosbash/rosbash +++ b/tools/rosbash/rosbash @@ -324,8 +324,25 @@ function _roscomplete_rosparam { if [[ $COMP_CWORD == 1 ]]; then opts="set get load dump delete list" COMPREPLY=($(compgen -W "$opts" -- ${arg})) - else - COMPREPLY=($(compgen -f -- ${arg})) + elif [[ $COMP_CWORD == 2 ]]; then + case ${COMP_WORDS[1]} in + set|get|delete|list) + opts=`rosparam list` + COMPREPLY=($(compgen -W "$opts" -- ${arg})) + ;; + load|dump) + # complete on files + COMPREPLY=($(compgen -f -- ${arg})) + ;; + esac + elif [[ $COMP_CWORD == 3 ]]; then + case ${COMP_WORDS[1]} in + load|dump) + # complete on namespace + opts=`rosparam list` + COMPREPLY=($(compgen -W "$opts" -- ${arg})) + ;; + esac fi } @@ -336,7 +353,7 @@ function _roscomplete_rostopic { if [[ $COMP_CWORD == 1 ]]; then opts="bw echo hz list pub type find" COMPREPLY=($(compgen -W "$opts" -- ${arg})) - else + elif [[ $COMP_CWORD == 2 ]]; then case ${COMP_WORDS[1]} in bw|echo|hz|list|type) opts=`rostopic list` @@ -359,8 +376,19 @@ function _roscomplete_rosservice { if [[ $COMP_CWORD == 1 ]]; then opts="list call type find uri" COMPREPLY=($(compgen -W "$opts" -- ${arg})) - else - COMPREPLY=($(compgen -f -- ${arg})) + elif [[ $COMP_CWORD == 2 ]]; then + case ${COMP_WORDS[1]} in + uri|list|type) + opts=`rosservice list` + COMPREPLY=($(compgen -W "$opts" -- ${arg})) + ;; + find) + # Need a clever way to do message searching + ;; + call) + # This takes more logic. + ;; + esac fi }