All pastes #627171 Raw Edit

Anonymous

public shellscript v1 · immutable
·published 2007-07-20 03:54 UTC
rendered paste body
_svk_path(){   cur=${COMP_WORDS[COMP_CWORD]}   if [[ $cur == //*/* ]]; then       tail=`echo $cur | sed -r 's|^.*/([^/]*)$|\1|'`       head=`echo $cur | sed -r 's|^(.*)(/[^/]*)$|\1|'`   elif [[ $cur == //* ]]; then       tail=`echo $cur | sed 's|^//||'`       head="//"   else       return 0   fi   if [ $head == '//' ]; then       insert='//'   else       insert="$head/"   fi   words=`svk ls $head | sed "s|^|$insert|" | tr '\n' ' '`   COMPREPLY=( $( compgen -W "$words" -- $cur ) )   return 0}complete -F _svk_path -o default -o nospace svk