summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_perforce
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_perforce')
-rw-r--r--Completion/Unix/Command/_perforce40
1 files changed, 38 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index aab8d99ed..3d7de0cb1 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -397,7 +397,7 @@ _perforce_call_p4() {
(( $+functions[_perforce_gen_cmd_list] )) ||
_perforce_gen_cmd_list() {
(( ${+_perforce_cmd_list} )) || typeset -ga _perforce_cmd_list
- local hline
+ local hline line match mbegin mend
# Output looks like <tab>command-name<space>description in words...
# Ignore blank lines and the heading line beginning `Perforce...'
# Just gets run once, then cached, so don't bother optimising
@@ -407,6 +407,18 @@ _perforce_gen_cmd_list() {
[[ $hline[1] = (#i)perforce ]] && continue
_perforce_cmd_list+=("${hline[1]}:${hline[2,-1]}")
done
+ # Also cache the server version for nefarious purposes.
+ _perforce_call_p4 info info | while read line; do
+ if [[ $line = (#b)"Server version: "*/*/(<->.<->)/*" "(*) ]]; then
+ _perforce_server_version=$match[1]
+ fi
+ done
+ if [[ -n ${_perforce_server_version} && \
+ ${_perforce_server_version%%.*} -ge 2004 && \
+ ${_perforce_cmd_list[(r)attribute:*]} = '' ]]; then
+ # As yet unsupported attribute command
+ _perforce_cmd_list+=("attribute:Set attributes for open file (EXPERIMENTAL)")
+ fi
}
@@ -1389,6 +1401,23 @@ _perforce_cmd_annotate() {
'*::file:_perforce_files -tR'
}
+
+(( $+functions[_perforce_cmd_attribute] )) ||
+_perforce_cmd_attribute() {
+ # This is currently (2005.1) an unsupported command.
+ # See "p4 help undoc".
+ local limit
+ # If -f is present, search unopened files, else don't
+ [[ ${words[(I)-f]} -eq 0 ]] && limit=" -to"
+ _arguments -s : \
+ '-e[Value is in hex]' \
+ '-f[Set the attribute on a submitted file]' \
+ '-n[Set name of attribute]:attribute: ' \
+ '-v[Set value of attribute]:value: ' \
+ "*::file:_perforce_files$limit"
+}
+
+
(( $+functions[_perforce_cmd_branch] )) ||
_perforce_cmd_branch() {
_arguments -s : \
@@ -1620,6 +1649,12 @@ _perforce_cmd_flush() {
(( $+functions[_perforce_cmd_fstat] )) ||
_perforce_cmd_fstat() {
+ local Oattr Aattr
+ if [[ ${_perforce_cmd_list[(r)attribute:*]} != '' ]]; then
+ # Unsupported feature, try not to show if not present
+ Oattr=' a\:show\ attributes d\:attributes\ digest e\:attributes\ in\ hex'
+ Aattr='-A[Restrict attributes by pattern]:attribute pattern: '
+ fi
_arguments -s : \
'-c+[affected since change]:change:_perforce_changes -ts' \
'-e+[affected by change]:change:_perforce_changes -ts' \
@@ -1627,10 +1662,11 @@ _perforce_cmd_fstat() {
'-H[select synced files (-Rh)]' \
'-W[select opened files (-Ro)]' \
'-l[include fileSize, possibly slow (-Ol)]' \
- '-O-[select output type]:output type:((f\:all\ revisions l\:fileSize p\:client\ path\ format r\:pending\ integrations s\:exclude\ local\ path))' \
+ "-O-[select output type]:output type:((f\:all\ revisions l\:fileSize p\:client\ path\ format r\:pending\ integrations s\:exclude\ local\ path$Oattr))" \
'-P[output clientFile in full Perforce syntax (-Op)]' \
'-R-[restrict selected files]:restriction:((c\:mapped\ in\ client h\:synced\ to\ client n\:not\ synced\ to\ head o\:opened r\:resolved u\:unresolved))' \
'-s[shorten, no client-related data (-Os)]' \
+ $Aattr \
'*::file:_perforce_files'
}