* Completing arguments containing the colon character @ 2011-10-28 23:12 Gabor Maghera 2011-10-28 23:25 ` Daniel Shahaf 2011-10-29 18:30 ` Peter Stephenson 0 siblings, 2 replies; 4+ messages in thread From: Gabor Maghera @ 2011-10-28 23:12 UTC (permalink / raw) To: zsh-users [-- Attachment #1: Type: text/plain, Size: 858 bytes --] We use a naming standard for Perforce specs of the form "<username>::<arbitrary>". Zsh autocompletion cannot process these entries, due to the colon character being used as a list separator by its mechanism (as I understand). Is there a way to make it work? I've been perusing the man page for zcompsys, as well as the _perforce completion module, but I'm not sure it's possible. Here is an example of what the erroneous completions look like: % p4 client -o p4droid<tab><tab> p4droid -- :PerforceTriggers:2009/12/29 root /opt/local/perforce/trigger_scripts 'Created by p4droid. ' p4droid -- :triggers:2009/12/18 root /Workspace/trigger_test 'Created by gabor.maghera. ' The full entry names are p4droid::PerforceTriggers and p4doird::triggers. Thanks in advance, Gabor ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Completing arguments containing the colon character 2011-10-28 23:12 Completing arguments containing the colon character Gabor Maghera @ 2011-10-28 23:25 ` Daniel Shahaf 2011-10-29 18:30 ` Peter Stephenson 1 sibling, 0 replies; 4+ messages in thread From: Daniel Shahaf @ 2011-10-28 23:25 UTC (permalink / raw) To: Gabor Maghera; +Cc: zsh-users Gabor Maghera wrote on Fri, Oct 28, 2011 at 16:12:05 -0700: > We use a naming standard for Perforce specs of the form > "<username>::<arbitrary>". Zsh autocompletion cannot process these entries, > due to the colon character being used as a list separator by its mechanism > (as I understand). > > Is there a way to make it work? I've been perusing the man page for > zcompsys, as well as the _perforce completion module, but I'm not sure it's > possible. > > Here is an example of what the erroneous completions look like: > % p4 client -o p4droid<tab><tab> > p4droid -- > :PerforceTriggers:2009/12/29 root /opt/local/perforce/trigger_scripts > 'Created by p4droid. ' > p4droid -- :triggers:2009/12/18 > root /Workspace/trigger_test 'Created by gabor.maghera. ' > > The full entry names are p4droid::PerforceTriggers and p4doird::triggers. > So I assumed you'd like % p4 client -o p4droid<tab> to suggest 'p4droid::PerforceTriggers' and 'p4doird::triggers'? I don't know how to do that, but it's definitely possible: % perldoc File::<tab> File::Basename File::DosGlob File::Listing File::Spec::Functions File::Spec::Win32 File::CheckTree File::Fetch File::Path File::Spec::Mac File::stat File::Compare File::Find File::Spec File::Spec::OS2 File::Temp File::Copy File::Glob File::Spec::Cygwin File::Spec::Unix File::Copy::Recursive File::GlobMapper File::Spec::Epoc File::Spec::VMS > Thanks in advance, > Gabor HTH, Daniel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Completing arguments containing the colon character 2011-10-28 23:12 Completing arguments containing the colon character Gabor Maghera 2011-10-28 23:25 ` Daniel Shahaf @ 2011-10-29 18:30 ` Peter Stephenson 2011-10-31 19:34 ` Gabor Maghera 1 sibling, 1 reply; 4+ messages in thread From: Peter Stephenson @ 2011-10-29 18:30 UTC (permalink / raw) To: zsh-users On Fri, 28 Oct 2011 16:12:05 -0700 Gabor Maghera <gmaghera@gmail.com> wrote: > We use a naming standard for Perforce specs of the form > "<username>::<arbitrary>". Zsh autocompletion cannot process these entries, > due to the colon character being used as a list separator by its mechanism > (as I understand). Right, but the quoting convention is straightforward -- just apply a backslash. The following should be good enough. I've tried to apply it everywhere it could possibly make sense; it should be harmless if it's not needed. Just possibly you might get some extra backslashes in descriptive text, since I haven't attempted to separate that out. (By the way I don't usually post updates to _perforce since they aren't of general interest, so it's often worth checking the archive.) Index: Completion/Unix/Command/_perforce =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_perforce,v retrieving revision 1.52 diff -p -u -r1.52 _perforce --- Completion/Unix/Command/_perforce 17 Oct 2011 17:00:49 -0000 1.52 +++ Completion/Unix/Command/_perforce 29 Oct 2011 18:28:22 -0000 @@ -603,7 +603,7 @@ _perforce_global_options() { _perforce_branches() { local bline match mbegin mend local -a bl - bl=(${${${(f)"$(_perforce_call_p4 branches branches 2>/dev/null)"}##Branch }/ /:}) + bl=(${${${${(f)"$(_perforce_call_p4 branches branches 2>/dev/null)"}##Branch }//:/\\:}/ /:}) [[ $#bl -eq 1 && $bl[1] = '' ]] && bl=() (( $#bl )) && _describe -t branches 'Perforce branch' bl } @@ -685,7 +685,7 @@ awk '/^Client:/ { print $2 }')") # Limit to the 20 most recent changes by default to avoid huge # output. cl=( -${${${${(f)"$(_perforce_call_p4 changes changes $amax $xargs $cstatus \$file)"}##Change\ }//\ on\ /:}/\ by\ /\ } +${${${${${(f)"$(_perforce_call_p4 changes changes $amax $xargs $cstatus \$file)"}##Change\ }//:/\\:}//\ on\ /:}/\ by\ /\ } ) # "default" can't have shelved files in it... [[ $ctype = shelved* ]] || cl+=("default:change not yet numbered") @@ -711,7 +711,7 @@ _perforce_clients() { compset -P '//' && slash=(-S/ -q) fi - cl=(${${${(f)"$(_perforce_call_p4 clients clients)"}##Client\ }/\ /:}) + cl=(${${${${(f)"$(_perforce_call_p4 clients clients)"}##Client\ }//:/\\:}/\ /:}) [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=() _describe -t clients 'Perforce client' cl $slash } @@ -722,7 +722,7 @@ _perforce_counters() { local cline match mbegin mend local -a cl - cl=(${${${(f)"$(_perforce_call_p4 counters counters)"}/\ /:}/\=/current value}) + cl=(${${${${(f)"$(_perforce_call_p4 counters counters)"}//:/\\:}/\ /:}/\=/current value}) [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=() _describe -t counters 'Perforce counter' cl } @@ -796,7 +796,7 @@ _perforce_depots() { local dline match mbegin mend local -a dl - dl=(${${${(f)"$(_perforce_call_p4 depots depots)"}##Depot\ }/\ /:}) + dl=(${${${${(f)"$(_perforce_call_p4 depots depots)"}##Depot\ }//:/\\:}/\ /:}) [[ $#dl -eq 1 && $dl[1] = '' ]] && dl=() _describe -t depots 'depot name' dl } @@ -1594,7 +1594,7 @@ _perforce_submit_options() { _perforce_pids() { local -a ul - ul=(${${${(f)"$(_perforce_call_p4 monitor monitor show 2>/dev/null)"}# *}/\ /:}) + ul=(${${${${(f)"$(_perforce_call_p4 monitor monitor show 2>/dev/null)"}# *}//:/\\:}/\ /:}) [[ $#ul -eq 1 && $ul[1] = '' ]] && ul=() _describe -t id 'process ID' ul } @@ -1604,7 +1604,7 @@ _perforce_pids() { _perforce_users() { local -a ul - ul=(${${(f)"$(_perforce_call_p4 users users)"}/\ /:}) + ul=(${${${(f)"$(_perforce_call_p4 users users)"}//:/\\:}/\ /:}) [[ $#ul -eq 1 && $ul[1] = '' ]] && ul=() _describe -t users 'Perforce user' ul } -- Peter Stephenson <p.w.stephenson@ntlworld.com> Web page now at http://homepage.ntlworld.com/p.w.stephenson/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Completing arguments containing the colon character 2011-10-29 18:30 ` Peter Stephenson @ 2011-10-31 19:34 ` Gabor Maghera 0 siblings, 0 replies; 4+ messages in thread From: Gabor Maghera @ 2011-10-31 19:34 UTC (permalink / raw) To: Peter Stephenson; +Cc: zsh-users [-- Attachment #1: Type: text/plain, Size: 4230 bytes --] Thank you, Peter. I grabbed the latest revision from SourceForge. It works like a charm. Cheers, Gabor On Sat, Oct 29, 2011 at 11:30 AM, Peter Stephenson < p.w.stephenson@ntlworld.com> wrote: > On Fri, 28 Oct 2011 16:12:05 -0700 > Gabor Maghera <gmaghera@gmail.com> wrote: > > We use a naming standard for Perforce specs of the form > > "<username>::<arbitrary>". Zsh autocompletion cannot process these > entries, > > due to the colon character being used as a list separator by its > mechanism > > (as I understand). > > Right, but the quoting convention is straightforward -- just apply a > backslash. The following should be good enough. I've tried to apply it > everywhere it could possibly make sense; it should be harmless if it's > not needed. Just possibly you might get some extra backslashes in > descriptive text, since I haven't attempted to separate that out. > > (By the way I don't usually post updates to _perforce since they aren't > of general interest, so it's often worth checking the archive.) > > Index: Completion/Unix/Command/_perforce > =================================================================== > RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_perforce,v > retrieving revision 1.52 > diff -p -u -r1.52 _perforce > --- Completion/Unix/Command/_perforce 17 Oct 2011 17:00:49 -0000 > 1.52 > +++ Completion/Unix/Command/_perforce 29 Oct 2011 18:28:22 -0000 > @@ -603,7 +603,7 @@ _perforce_global_options() { > _perforce_branches() { > local bline match mbegin mend > local -a bl > - bl=(${${${(f)"$(_perforce_call_p4 branches branches > 2>/dev/null)"}##Branch }/ /:}) > + bl=(${${${${(f)"$(_perforce_call_p4 branches branches > 2>/dev/null)"}##Branch }//:/\\:}/ /:}) > [[ $#bl -eq 1 && $bl[1] = '' ]] && bl=() > (( $#bl )) && _describe -t branches 'Perforce branch' bl > } > @@ -685,7 +685,7 @@ awk '/^Client:/ { print $2 }')") > # Limit to the 20 most recent changes by default to avoid huge > # output. > cl=( > -${${${${(f)"$(_perforce_call_p4 changes changes $amax $xargs $cstatus > \$file)"}##Change\ }//\ on\ /:}/\ by\ /\ } > +${${${${${(f)"$(_perforce_call_p4 changes changes $amax $xargs $cstatus > \$file)"}##Change\ }//:/\\:}//\ on\ /:}/\ by\ /\ } > ) > # "default" can't have shelved files in it... > [[ $ctype = shelved* ]] || cl+=("default:change not yet numbered") > @@ -711,7 +711,7 @@ _perforce_clients() { > compset -P '//' && slash=(-S/ -q) > fi > > - cl=(${${${(f)"$(_perforce_call_p4 clients clients)"}##Client\ }/\ /:}) > + cl=(${${${${(f)"$(_perforce_call_p4 clients clients)"}##Client\ > }//:/\\:}/\ /:}) > [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=() > _describe -t clients 'Perforce client' cl $slash > } > @@ -722,7 +722,7 @@ _perforce_counters() { > local cline match mbegin mend > local -a cl > > - cl=(${${${(f)"$(_perforce_call_p4 counters counters)"}/\ /:}/\=/current > value}) > + cl=(${${${${(f)"$(_perforce_call_p4 counters counters)"}//:/\\:}/\ > /:}/\=/current value}) > [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=() > _describe -t counters 'Perforce counter' cl > } > @@ -796,7 +796,7 @@ _perforce_depots() { > local dline match mbegin mend > local -a dl > > - dl=(${${${(f)"$(_perforce_call_p4 depots depots)"}##Depot\ }/\ /:}) > + dl=(${${${${(f)"$(_perforce_call_p4 depots depots)"}##Depot\ > }//:/\\:}/\ /:}) > [[ $#dl -eq 1 && $dl[1] = '' ]] && dl=() > _describe -t depots 'depot name' dl > } > @@ -1594,7 +1594,7 @@ _perforce_submit_options() { > _perforce_pids() { > local -a ul > > - ul=(${${${(f)"$(_perforce_call_p4 monitor monitor show 2>/dev/null)"}# > *}/\ /:}) > + ul=(${${${${(f)"$(_perforce_call_p4 monitor monitor show > 2>/dev/null)"}# *}//:/\\:}/\ /:}) > [[ $#ul -eq 1 && $ul[1] = '' ]] && ul=() > _describe -t id 'process ID' ul > } > @@ -1604,7 +1604,7 @@ _perforce_pids() { > _perforce_users() { > local -a ul > > - ul=(${${(f)"$(_perforce_call_p4 users users)"}/\ /:}) > + ul=(${${${(f)"$(_perforce_call_p4 users users)"}//:/\\:}/\ /:}) > [[ $#ul -eq 1 && $ul[1] = '' ]] && ul=() > _describe -t users 'Perforce user' ul > } > > > -- > Peter Stephenson <p.w.stephenson@ntlworld.com> > Web page now at http://homepage.ntlworld.com/p.w.stephenson/ > > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-31 19:34 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-10-28 23:12 Completing arguments containing the colon character Gabor Maghera 2011-10-28 23:25 ` Daniel Shahaf 2011-10-29 18:30 ` Peter Stephenson 2011-10-31 19:34 ` Gabor Maghera
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).