zsh-workers
 help / color / mirror / code / Atom feed
* Re: screen -x <complete>
@ 2001-11-09 18:29 Felix Rosencrantz
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Rosencrantz @ 2001-11-09 18:29 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

I use GNU screen regularly and wrote a simple completion function for it. 
However, it only handled the -x flag.  Since, there was some interest on this
list, I decide to see if I could easily generate a function via the XML code. 
I think I was able to get a good first pass completion function via the XML
code, which I'm happy about.  It did require some hand editing, but not too
much.


The details about my xml completion generation can be found at:
http://www.geocities.com/f_rosencrantz/screen_generation.htm

Though if you just want the function I've attached it.  It's still could use
some work, but it's a reasonable start.   I think it would be interesting to
add  completions for the commands that can be handed to the "screen -X"
command.  That would need to use the <subcommands> element in screen.xml.

-FR.

__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

[-- Attachment #2: screen.txt --]
[-- Type: text/plain, Size: 3622 bytes --]

#compdef screen 
#Generated by args.xsl  For details see:
#    http://www.geocities.com/f_rosencrantz/clearcase_generation.htm
 local context state line
           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.:->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 3.09.11beta (FAU) 11-Oct-01".' \
		'-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.:( acladd  addacl  aclchg  acldel  aclgrp  aclumask  activity  allpartial  at  attrcolor  autodetach  autonuke  bce  bell_msg  bind  bindkey  break  breaktype  bufferfile  c1  caption  charset  chdir  clear  colon  command  compacthist  console  copy  copy_reg  crlf  debug  defc1  defautonuke  defbce  defbreaktype  defcharset  defescape  defflow  defgr  defhstatus  defkanji  deflogin  defmode  defmonitor  defobuflimit  defscrollback  defshell  defsilence  defslowpaste  defutf8  defwrap  defwritelock  defzombie  detach  dinfo  displays  digraph  dumptermcap  echo  escape  exec  fit  flow  focus  gr  hardcopy  hardcopy_append  hardcopydir  hardstatus  height  help  history  hstatus  info  ins_reg  kill  lastmsg  license  lockscreen  log  logfile  login  logtstamp  mapdefault  mapnotnext  maptimeout  markkeys  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  shell  shelltitle  silence  silencewait  sleep  slowpaste  sorendition  split  startup_message  stuff  su  term  termcap  terminfo  termcapinfo  time  title  unsetenv  utf8  vbell  vbell_msg  vbellwait  verbose  version  wall  width  windows  wrap  writebuf  writelock  xoff  xon  zombie  defzombie)'
case $state in
  sessionname)
  # Complete folder names.
  local screendir

    screendir=(`screen -ls | grep Socket | tail -1 | sed -e 's/\.$//' | awk '{print $NF;}'`)

  _wanted files expl 'screen process' _path_files -W screendir
;;
esac
    

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: screen -x <complete>
  2001-10-22 16:54 Michal Maruška
@ 2001-10-22 17:40 ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2001-10-22 17:40 UTC (permalink / raw)
  To: Michal Maruška, Zsh hackers list

"Michal =?iso-8859-2?q?Maru=B9ka?=" wrote:
> 
> 
> I've decided i would try to look at the completion system of zsh. 
> I want to complete on sessions opened by screen(1):
> 
> i get when running:
> $ screen -x
> > There are several suitable screens on:
> >        899.pts-10.linux3       (Attached)
> >        326.pts-54.linux3       (Attached)
> > Type "screen [-d] -r [pid.]tty.host" to resume one of them.
> 
> 
> Could anybody tell me where to start (i want to learn it by example, manual
> -reading will follow), or has it already been implemented?

Apparently no-one's done screen yet, it would be useful to have a function.

There are various strands.  First (or maybe last) you probably want to look
at one of the many functions that use _arguments to handle options and
arguments, so you can handle these for screen.

Then you need to persuade _arguments to handle the remaining arguments as a
new command.  Look at, for example, Completion/Unix/Command/_rlogin.  This
has already got some simple _arguments handling for you.

Finally, you want to be able to postprocess the output of `screen -ls' to
get detached sessions to reattach to.  A very simple example of adding
a list from the output of a command occurs in Completion/Zsh/Type/_limits.

You might want to have a look at
  http://zsh.sunsite.dk/Guide/zshguide06.html#l142

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

* screen -x <complete>
@ 2001-10-22 16:54 Michal Maruška
  2001-10-22 17:40 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Maruška @ 2001-10-22 16:54 UTC (permalink / raw)
  To: Zsh hackers list



I've decided i would try to look at the completion system of zsh. 
I want to complete on sessions opened by screen(1):

i get when running:
$ screen -x
> There are several suitable screens on:
>        899.pts-10.linux3       (Attached)
>        326.pts-54.linux3       (Attached)
> Type "screen [-d] -r [pid.]tty.host" to resume one of them.


Could anybody tell me where to start (i want to learn it by example, manual
-reading will follow), or has it already been implemented?


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-11-09 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-09 18:29 screen -x <complete> Felix Rosencrantz
  -- strict thread matches above, loose matches on Subject: below --
2001-10-22 16:54 Michal Maruška
2001-10-22 17:40 ` Peter Stephenson

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).