[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] bash_completion: propose file names for few commands

From: Krzysiek Pawlik <nelchael_at_gentoo.org>
Date: 2007-03-22 11:09:15 CET

Hi,

attached patch adds completion of file names for certain commands (revert, add,
log and remove), for example for revert it suggestes modified or missing files,
for add - unknown files, etc. Current version suggests all file names for those
commands.

-- 
Krzysiek Pawlik   <nelchael at gentoo.org>   key id: 0xBC555551
desktop-misc, desktop-dock, x86, java, apache, ppc...

Index: tools/client-side/bash_completion
===================================================================
--- tools/client-side/bash_completion (revision 23971)
+++ tools/client-side/bash_completion (working copy)
@@ -426,6 +426,24 @@
         # if not typing an option,
         # then fallback on ordinary filename expansion
         if [[ $cur != -* || $stat = 'onlyarg' ]] ; then
+ case $cmd in
+ revert)
+ local FILESrevert="$(svn status --non-interactive | grep '^[M!]' | awk '{print $2}')"
+ COMPREPLY=( $( compgen -W "$FILESrevert" -- $cur ) )
+ ;;
+ add)
+ local FILESadd="$(svn status --non-interactive | grep '^?' | awk '{print $2}')"
+ COMPREPLY=( $( compgen -W "$FILESadd" -- $cur ) )
+ ;;
+ log)
+ local FILESlog="$(svn status --non-interactive --verbose --non-recursive | awk '{print $4}')"
+ COMPREPLY=( $( compgen -W "$FILESlog" -- $cur ) )
+ ;;
+ remove|rm|delete|del)
+ local FILESremove="$(svn status --non-interactive --verbose --non-recursive | sed -e 's,^.,,' | awk '{print $4}' | grep -v '^\.$')"
+ COMPREPLY=( $( compgen -W "$FILESremove" -- $cur ) )
+ ;;
+ esac
             return 0
         fi
 

Received on Thu Mar 22 11:06:33 2007

This is an archived mail posted to the Subversion Dev mailing list.