- move p4 completion into contrib, since not many people have this

This commit is contained in:
ianmacd 2002-03-22 15:50:29 +00:00
parent 3ff74ba156
commit 0946ad341f
2 changed files with 60 additions and 62 deletions

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05a
#
# $Id: bash_completion,v 1.208 2002/03/22 16:45:42 ianmacd Exp $
# $Id: bash_completion,v 1.209 2002/03/22 16:50:29 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
@ -1780,67 +1780,6 @@ _root_command()
}
complete -F _root_command -o filenames sudo
# Perforce completion
#
have p4 &&
_p4()
{
local cur prev prev2 p4commands p4filetypes
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
# rename isn't really a command
p4commands="add admin branch branches change changes client \
clients counter counters delete depot depots describe \
diff diff2 dirs edit filelog files fix fixes flush \
fstat group groups have help info integrate integrated \
job jobs jobspec label labels labelsync lock obliterate \
opened passwd print protect rename reopen resolve \
resolved revert review reviews set submit sync triggers \
typemap unlock user users verify where"
p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \
uresource uxbinary xbinary xltext xtempobj xtext \
text binary resource"
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W "$p4commands" -- $cur ) )
elif [ $COMP_CWORD -eq 2 ]; then
case "$prev" in
help)
COMPREPLY=( $( compgen -W "simple commands \
environment filetypes jobview revisions \
usage views $p4commands" -- $cur ) )
;;
admin)
COMPREPLY=( $( compgen -W "checkpoint stop" -- $cur ) )
;;
*)
;;
esac
elif [ $COMP_CWORD -gt 2 ]; then
prev2=${COMP_WORDS[COMP_CWORD-2]}
case "$prev" in
-t)
case "$prev2" in
add|edit|reopen)
COMPREPLY=( $( compgen -W "$p4filetypes" \
-- $cur) )
;;
*)
;;
esac
;;
*)
;;
esac
fi
return 0
}
[ "$have" ] && complete -F _p4 -o default p4 g4
# ant(1) completion
#
have ant &&

59
contrib/p4 Normal file
View File

@ -0,0 +1,59 @@
# Perforce completion by Frank Cusack <frank@google.com>
_p4()
{
local cur prev prev2 p4commands p4filetypes
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
# rename isn't really a command
p4commands="add admin branch branches change changes client \
clients counter counters delete depot depots describe \
diff diff2 dirs edit filelog files fix fixes flush \
fstat group groups have help info integrate integrated \
job jobs jobspec label labels labelsync lock obliterate \
opened passwd print protect rename reopen resolve \
resolved revert review reviews set submit sync triggers \
typemap unlock user users verify where"
p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \
uresource uxbinary xbinary xltext xtempobj xtext \
text binary resource"
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W "$p4commands" -- $cur ) )
elif [ $COMP_CWORD -eq 2 ]; then
case "$prev" in
help)
COMPREPLY=( $( compgen -W "simple commands \
environment filetypes jobview revisions \
usage views $p4commands" -- $cur ) )
;;
admin)
COMPREPLY=( $( compgen -W "checkpoint stop" -- $cur ) )
;;
*)
;;
esac
elif [ $COMP_CWORD -gt 2 ]; then
prev2=${COMP_WORDS[COMP_CWORD-2]}
case "$prev" in
-t)
case "$prev2" in
add|edit|reopen)
COMPREPLY=( $( compgen -W "$p4filetypes" \
-- $cur) )
;;
*)
;;
esac
;;
*)
;;
esac
fi
return 0
}
complete -F _p4 -o default p4 g4