Zsh Mailing List Archive
Messages sorted by:
Implementing a menu (list) in a zsh script (as in command line)
- X-seq: zsh-users 17514
- From: rahul <rahul2012@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Implementing a menu (list) in a zsh script (as in command line)
- Date: Mon, 31 Dec 2012 10:59:59 +0530
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=gI0i2BfkrlBhr5NaQJWz0UiFwGT852aAWVKsYivr/ug=; b=0MXiTwNdOrg4DCBjJq911cs6HcMD/t88ylWwWXdXcEETENGGQFiFwltTAhZeI7Qkx5 A59vYgW8FF/A7dt7JlIpkJJOSF+a6MWREoDp0aphEUVCLuP0bTPtDAYWPXWNC4VwDnLW FvuLFnkI4QIBDGhoS9G1KTScf9U4ZrfsT+SaBFuJVW7BuJlykxnTuvO3DdbKX+xaDXiX NreMZAUXyHrn7UN6Wyd6Rd1YUD68g+XkL+2b4/izgyHseNpjzWIR10N6FinB35tKIZJG fbAIy8pKdjVDiN3ib+jbt0AQdMi8Vh7H/wYpM9PTjdpSdWmwIDq3CaG6Ru30jt3ohRzo nnng==
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
I am writing an application in zsh. I typically use read -k or vared for
getting user input. However, I'd like the user to get a menu as he types or
tabs, just as it happens on the zsh command line. I'd like him to be able
to navigate the menu just as on the command line.
Currently, I've implemented this in some cases using read -k and displaying
the data again with each keystroke and the user has to type in the row
number to finally select a row. However, user cannot navigate. I'd like to
use zsh's inbuilt facilities if possible rather than reimplement.
Also in the case of using vared, I am unable to give any options (although
if it happens to be a path, then vared does allow tabbing and completion).
I did see an application that does implement something similar called
"zaw". It seems to use "zle" but I was lost reading the code. "man zle"
hasn't helped much and I could not find any simple tutorial or examples.
Also, using "read -k" can one accept control characters and arrow keys ? It
seems I would have to do multiple reads?
Messages sorted by: