zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: zle separability
Date: Mon, 25 Apr 2005 16:09:27 +0000	[thread overview]
Message-ID: <1050425160927.ZM24988@candle.brasslantern.com> (raw)
In-Reply-To: <20050425075146.GC28168@a5.repetae.net>

On Apr 25, 12:51am, Frederik Eaton wrote:
}
} Thanks. I guess there's always writing a zsh script to do the
} interfacing, but that wouldn't be ideal.

The Functions/Misc/nslookup script in the zsh distribution is the
classic example of doing this.  If your underlying command doesn't
expect to print its own prompts on a terminal, you can even leave
out the zpty stuff and just do a "while vared" loop.
 
} (... but, by the way, it would still be nice if such uses for zsh were
} better supported, with for instance support for reading an arbitrary
} config file or executing an arbitrary fragment before opening an
} interactive shell, or for a function which can be defined to handle
} all interactive commands)

Interactive shells are for interacting with the shell.  You don't need
an interactive shell to interact with some other command.  E.g. to
repeatedly read command-line arguments of "dig" and then call dig with
those arguments:

zsh -c 'while line=""; vared -e -p "$0: " line; do $0 $=line; done' dig

The use of $0 means you can replace "dig" above with any other command
name and it'll work the same way.  It's a little trickier if you want
to add history support, but not too bad.


  parent reply	other threads:[~2005-04-25 16:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-24 19:37 Frederik Eaton
2005-04-24 23:08 ` DervishD
2005-04-25  7:51   ` Frederik Eaton
2005-04-25 10:49     ` DervishD
2005-04-25 11:04       ` Frederik Eaton
2005-04-25 11:39         ` DervishD
2005-04-25 11:58           ` Frederik Eaton
2005-04-25 16:02             ` DervishD
2005-04-28  5:45               ` Frederik Eaton
2005-04-28  7:45                 ` DervishD
2005-04-25 16:09             ` Bart Schaefer [this message]
2005-04-28  5:59               ` Frederik Eaton
2005-04-28  8:17                 ` Bart Schaefer
2005-04-28 10:04                   ` Peter Stephenson
2005-04-28 14:55                     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1050425160927.ZM24988@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).