From: Eric Cook <llua@gmx.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] zed: fix argument parsing
Date: Sat, 31 Oct 2015 14:08:43 -0400 [thread overview]
Message-ID: <563503AB.3030200@gmx.com> (raw)
In-Reply-To: <1446000872-26311-1-git-send-email-llua@gmx.com>
On 10/27/2015 10:54 PM, Eric Cook wrote:
> Also reported in IRC:
>
> % fned +vi-git-applied-string
> zed:4: bad option: -v
> zed:4: bad option: -i
> zed:4: bad option: --
> zed:4: bad option: -g
> ...
>
> This could optionally be fixed by changing getopts "fbx:" to
> getopts ":fbx:" so the `unknown options' are silently ignored.
:/ that patch allows `zed -foo' to edit the function `-foo'.
It should error due to unknown options in my opinion.
I think editing files/functions that start with `+' or `-' should require -- to be used.
This patch silents the bad options errors, shown in my first example and zed will show the help message.
To edit the function `+vi-git-applied-string', `--' is needed.
diff --git a/Functions/Misc/zed b/Functions/Misc/zed
index 1f6042e..2c957ba 100644
--- a/Functions/Misc/zed
+++ b/Functions/Misc/zed
@@ -11,7 +11,7 @@ local var opt zed_file_name
integer TMOUT=0 okargs=1 fun bind
local -a expand
-while getopts "fbx:" opt; do
+while getopts ":fbx:" opt; do
case $opt in
(f)
fun=1
prev parent reply other threads:[~2015-10-31 18:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 16:22 [PATCH] Add -- to the `functions' builtin calls Eric Cook
2015-10-27 17:54 ` [PATCH v2] " Eric Cook
2015-10-28 2:54 ` [PATCH] zed: fix argument parsing Eric Cook
2015-10-31 18:08 ` Eric Cook [this message]
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=563503AB.3030200@gmx.com \
--to=llua@gmx.com \
--cc=zsh-workers@zsh.org \
/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).