* Completion function for _screen
@ 2003-04-19 16:43 Felix Rosencrantz
2003-04-22 15:38 ` Felix Rosencrantz
0 siblings, 1 reply; 2+ messages in thread
From: Felix Rosencrantz @ 2003-04-19 16:43 UTC (permalink / raw)
To: zw
[-- Attachment #1: Type: text/plain, Size: 248 bytes --]
A version of this has been shipping with screen for a while now. Just adding
it to the zsh distribution.
-FR.
__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com
[-- Attachment #2: scr_diff.txt --]
[-- Type: text/plain, Size: 4719 bytes --]
Index: Completion/Unix/Command/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/.distfiles,v
retrieving revision 1.38
diff -u -r1.38 .distfiles
--- Completion/Unix/Command/.distfiles 14 Mar 2003 12:14:30 -0000 1.38
+++ Completion/Unix/Command/.distfiles 19 Apr 2003 16:35:19 -0000
@@ -19,5 +19,5 @@
_fsh _chkconfig _cdcd _irssi _mysqldiff _sccs
_netcat _larch _texinfo _figlet _elinks _tidy
_global _global_tags _ant _lsof _mt _xmlsoft
-_perforce _python _antiword
+_perforce _python _antiword _screen
'
Index: Completion/Unix/Command/_screen
===================================================================
RCS file: Completion/Unix/Command/_screen
diff -N Completion/Unix/Command/_screen
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_screen 19 Apr 2003 16:35:20 -0000
@@ -0,0 +1,83 @@
+#compdef screen
+#Generated by Felix Rosencrantz
+
+ local context state line scr_cmds
+ scr_cmds=(
+ acladd aclchg acldel aclgrp aclumask
+ activity addacl allpartial at attrcolor
+ autodetach autonuke backtick bce bell_msg
+ bind bindkey break breaktype bufferfile
+ c1 caption charset chdir clear
+ colon command compacthist console copy
+ copy_reg crlf debug defautonuke defbce
+ defbreaktype defc1 defcharset defencoding defescape
+ defflow defgr defhstatus defkanji deflog
+ deflogin defmode defmonitor defobuflimit defscrollback
+ defshell defsilence defslowpaste defutf8 defwrap
+ defwritelock defzombie detach digraph dinfo
+ displays dumptermcap echo encoding escape
+ eval exec fit flow focus
+ gr hardcopy hardcopy_append hardcopydir hardstatus
+ height help history hstatus ignorecase
+ info ins_reg kill lastmsg license
+ lockscreen log logfile login logtstamp
+ mapdefault mapnotnext maptimeout markkeys maxwin
+ meta monitor msgminwait msgwait multiuser
+ nethack next nonblock number obuflimit
+ only other partial password paste
+ pastefont pow_break pow_detach pow_detach_msg prev
+ printcmd process quit readbuf readreg
+ redisplay register remove removebuf reset
+ resize screen scrollback select sessionname
+ setenv setsid shell shelltitle silence
+ silencewait sleep slowpaste sorendition source
+ split startup_message stuff su term
+ termcap termcapinfo terminfo time title
+ unsetenv utf8 vbell vbell_msg vbellwait
+ verbose version wall width windowlist
+ windows wrap writebuf writelock xoff
+ xon zombie
+ )
+
+ typeset -A opt_args
+ _arguments \
+ "-a[Force all capabilities into each window's termcap.]" \
+ '-A:Adapt all windows to the new display width & height.' \
+ "-c:Read configuration file instead of '.screenrc'.:_files -/" \
+ '-d:Detach the elsewhere running screen (with -r: reattach here).:->sessionname' \
+ '-dmS:Start as daemon: Screen session in detached mode.' \
+ '-D:Detach and logout remote (with -r: reattach here).' \
+ '-e:Change command characters.' \
+ '-f-:Flow control on, -fn = off, -fa = auto.:((n\:Flow\ conrol\ off a\:Flow\ conrol\ auto))' \
+ '-h:Set the size of the scrollback history buffer.' \
+ '-i[Interrupt output sooner when flow control is on.]' \
+ '-l[Login mode on (update /var/run/utmp), -ln = off.]' \
+ '-list[Do nothing, just list our SockDir.]' \
+ '-ls[Do nothing, just list our SockDir.]' \
+ "-L[Terminal's last character can be safely updated.]" \
+ '-m[ignore $STY variable, do create a new screen session.]' \
+ '-O[Choose optimal output rather than exact vt100 emulation.]' \
+ '-p:Preselect the named window if it exists.' \
+ '-q[Quiet startup. Exits with non-zero return code if unsuccessful.]' \
+ '-r[Reattach to a detached screen process.]:Handling Tag sessionname:->sessionname' \
+ '-R[Reattach if possible, otherwise start a new session.]' \
+ '-s:Shell to execute rather than $SHELL.' \
+ '-S:Name this session <pid>.sockname instead of <pid>.<tty>.<host>.' \
+ "-t:Set title. (window's name)." \
+ '-T:Use term as $TERM for windows, rather than "screen".' \
+ '-U[Tell screen to use UTF-8 encoding.]' \
+ '-v[Print screen version.]' \
+ '-wipe[Do nothing, just clean up SockDir.]' \
+ '-x[Attach to a not detached screen. (Multi display mode).]' \
+ '-X[Execute <cmd> as a screen command in the specified session.]:screencmd:(${scr_cmds[@]})'
+
+case $state in
+ "sessionname")
+ # Complete folder names.
+ local screendir
+
+ screendir=(`screen -ls | grep Socket | sed -n -e 's/\.$//' -e '$p' | awk '{print $NF;}'`)
+
+ _wanted files expl 'screen process' _path_files -W screendir
+;;
+esac
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Completion function for _screen
2003-04-19 16:43 Completion function for _screen Felix Rosencrantz
@ 2003-04-22 15:38 ` Felix Rosencrantz
0 siblings, 0 replies; 2+ messages in thread
From: Felix Rosencrantz @ 2003-04-22 15:38 UTC (permalink / raw)
To: zw
[-- Attachment #1: Type: text/plain, Size: 837 bytes --]
Here's a bit of clean up. Most of it based on feedback from Oliver, including
the style and screendir command to remove dependencies on sed&awk. Also, I've
made some improvements in arg handling for some flags.
-FR
ps it would nice if there was some sort of translation chart of sed/awk/perl
transformations into zsh parameter expressions... i tend to find reading
exisiting expressions very difficult. they contain lot's of grouping& special
syntax characters and no commenting... the worst of lisp and regexs rolled
into one...
--- Felix Rosencrantz <f_rosencrantz@yahoo.com> wrote:
> A version of this has been shipping with screen for a while now. Just adding
> it to the zsh distribution.
__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com
[-- Attachment #2: scr2_diff.txt --]
[-- Type: text/plain, Size: 5085 bytes --]
Index: Completion/Unix/Command/_screen
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_screen,v
retrieving revision 1.1
diff -u -r1.1 _screen
--- Completion/Unix/Command/_screen 19 Apr 2003 17:23:47 -0000 1.1
+++ Completion/Unix/Command/_screen 22 Apr 2003 15:16:51 -0000
@@ -1,8 +1,9 @@
#compdef screen
#Generated by Felix Rosencrantz
- local context state line scr_cmds
- scr_cmds=(
+local context state line scr_cmds
+typeset -A opt_args
+scr_cmds=(
acladd aclchg acldel aclgrp aclumask
activity addacl allpartial at attrcolor
autodetach autonuke backtick bce bell_msg
@@ -37,47 +38,44 @@
verbose version wall width windowlist
windows wrap writebuf writelock xoff
xon zombie
- )
+)
- typeset -A opt_args
- _arguments \
- "-a[Force all capabilities into each window's termcap.]" \
- '-A:Adapt all windows to the new display width & height.' \
- "-c:Read configuration file instead of '.screenrc'.:_files -/" \
- '-d:Detach the elsewhere running screen (with -r: reattach here).:->sessionname' \
- '-dmS:Start as daemon: Screen session in detached mode.' \
- '-D:Detach and logout remote (with -r: reattach here).' \
- '-e:Change command characters.' \
- '-f-:Flow control on, -fn = off, -fa = auto.:((n\:Flow\ conrol\ off a\:Flow\ conrol\ auto))' \
- '-h:Set the size of the scrollback history buffer.' \
- '-i[Interrupt output sooner when flow control is on.]' \
- '-l[Login mode on (update /var/run/utmp), -ln = off.]' \
- '-list[Do nothing, just list our SockDir.]' \
- '-ls[Do nothing, just list our SockDir.]' \
- "-L[Terminal's last character can be safely updated.]" \
- '-m[ignore $STY variable, do create a new screen session.]' \
- '-O[Choose optimal output rather than exact vt100 emulation.]' \
- '-p:Preselect the named window if it exists.' \
- '-q[Quiet startup. Exits with non-zero return code if unsuccessful.]' \
- '-r[Reattach to a detached screen process.]:Handling Tag sessionname:->sessionname' \
- '-R[Reattach if possible, otherwise start a new session.]' \
- '-s:Shell to execute rather than $SHELL.' \
- '-S:Name this session <pid>.sockname instead of <pid>.<tty>.<host>.' \
- "-t:Set title. (window's name)." \
- '-T:Use term as $TERM for windows, rather than "screen".' \
- '-U[Tell screen to use UTF-8 encoding.]' \
- '-v[Print screen version.]' \
- '-wipe[Do nothing, just clean up SockDir.]' \
- '-x[Attach to a not detached screen. (Multi display mode).]' \
- '-X[Execute <cmd> as a screen command in the specified session.]:screencmd:(${scr_cmds[@]})'
+_arguments \
+ "-a[force all capabilities into each window's termcap]" \
+ '-A[adapt all windows to the new display width & height]' \
+ "-c[read configuration file instead of '.screenrc']:config file:_files -/" \
+ '-d[detach the elsewhere running screen (with -r: reattach here)]:session name:->sessionname' \
+ '-dmS[start as daemon, screen session in detached mode]' \
+ '-D[detach and logout remote (with -r: reattach here)]' \
+ '-e[change command characters]:command characters:' \
+ '-f-[set flow control]:flow control:((n\:flow\ control\ off a\:Flow\ control\ auto \:Flow\ control\ on))' \
+ '-h[set the size of the scrollback history buffer]:buffer size:' \
+ '-i[interrupt output sooner when flow control is on]' \
+ '(-l)-ln[login mode off (do not update /var/run/utmp)]' \
+ '(-ln)-l[login mode on (update /var/run/utmp)]' \
+ '(-)'{-ls,-list}'[list sessions/socket directory]' \
+ "-L[terminal's last character can be safely updated]" \
+ '-m[ignore $STY variable, do create a new screen session]' \
+ '-O[choose optimal output rather than exact vt100 emulation]' \
+ '-p[preselect the named window]:window number or name:(( \=\:windowlist -\:blank\ window \:window\ number))' \
+ '-q[quiet startup. exits with non-zero return code if unsuccessful]' \
+ '-r[reattach to a detached screen process]:session name:->sessionname' \
+ '-R[reattach if possible, otherwise start a new session]' \
+ '-s[shell to execute rather than $SHELL]:shell name: _command_names -e' \
+ '-S[name this session <pid>.sockname instead of <pid>.<tty>.<host>]:session name:' \
+ "-t[set title(window's name)]:title:" \
+ '-T[use term as $TERM for windows, rather than "screen"]:terminal type:_terminals' \
+ '-U[tell screen to use UTF-8 encoding]' \
+ '(-)-v[print screen version]' \
+ '(-)-wipe[do nothing, clean up SockDir]' \
+ '-x[attach to a not detached screen. (Multi display mode).]' \
+ '-X[Execute <cmd> as a screen command in the specified session.]:screencmd:(${scr_cmds[@]})'
case $state in
- "sessionname")
- # Complete folder names.
+ sessionname)
+ # Complete session names
local screendir
-
- screendir=(`screen -ls | grep Socket | sed -n -e 's/\.$//' -e '$p' | awk '{print $NF;}'`)
-
- _wanted files expl 'screen process' _path_files -W screendir
-;;
+ screendir=( ${${${(M)${(f)"$(_call_program screen-session $words[1] -ls)"}:#*Socket*}%.}##* } )
+ _wanted screen-session expl 'screen process' _path_files -W screendir
+ ;;
esac
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-04-22 15:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-19 16:43 Completion function for _screen Felix Rosencrantz
2003-04-22 15:38 ` Felix Rosencrantz
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).