diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Completion/Unix/Command/_perforce | 19 |
2 files changed, 22 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 3151ca4e1..0254f783c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2003-09-25 Peter Stephenson <pws@csr.com> + * unposted: Completion/Unix/Command/_perforce: suggested by + Felix: use hostname from client, if any, for p4 -H completion + since no other name makes sense there. + * 19139: Test/B02typeset.ztst: add extra tests for typeset -T. 2003-09-25 Wayne Davison <wayned@users.sourceforge.net> diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index 8147244ba..8ec3baaaf 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -273,7 +273,7 @@ _perforce() { '-c+[client]:client:_perforce_clients' \ '-C+[charset]:charset:_perforce_charsets' \ '-d+[current directory]:directory:_path_files -g "*(/)"' \ - '-H+[hostname]:host:_hosts' \ + '-H+[hostname]:host:_perforce_hosts' \ '-G[python output]' \ '-L+[message language]:language: ' \ '-p+[server port]:port:_perforce_hosts_ports' \ @@ -1008,6 +1008,23 @@ _perforce_groups() { } +(( $+functions[_perforce_hosts] )) || +_perforce_hosts() { + local expl host + # Completion for p4 -H; other forms of host completion + # go through _perforce_hosts_ports. + # From Felix: if the client specifies a hostname, there's + # no point using any other host, since it won't work. + host=$(_perforce_call_p4 client client -o | + awk '$1 ~ /^Host:/ {print $2}' ) + if [[ -n $host ]]; then + _wanted hosts expl host compadd "$@" $host + else + _hosts + fi +} + + (( $+functions[_perforce_hosts_ports] )) || _perforce_hosts_ports() { if compset -P '*:'; then |