zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: PATCH misc. cleanup in bin_print()
Date: Sun, Jan 01 2016 00:37:55 +0000	[thread overview]
Message-ID: <20160110003755.GA6751@tarsus.local2> (raw)
In-Reply-To: <160104224749.ZM6378@torch.brasslantern.com>

Bart Schaefer wrote on Mon, Jan 04, 2016 at 22:47:49 -0800:
> Is there any objection to making some of these incompatible combinations
> of print options into errors, instead of either implicit precedences or
> bugs waiting to happen?  The one I left commented out has an explicit
> Test/B03* check so I'm guessing maybe there's a reason for it.
> 

+1 (concept): I think invalid flag combinations should result in
errors, but I haven't reviewed the patch in detail.

> +++ b/Src/builtin.c
> @@ -4036,10 +4036,46 @@ bin_print(char *name, char **args, Options ops, int func)
>      zulong zulongval;
>      char *stringval;
>  
> -    if (OPT_ISSET(ops, 'z') + OPT_ISSET(ops, 's') + OPT_ISSET(ops, 'v') > 1) {
> -	zwarnnam(name, "only one of -z, -s, or -v allowed");

Should -p be in this set too?

> +    /* Error check option combinations and option arguments */
> +
> +    if (OPT_ISSET(ops, 'z') +
> +	OPT_ISSET(ops, 's') + OPT_ISSET(ops, 'S') +
> +	OPT_ISSET(ops, 'v') > 1) {
> +	zwarnnam(name, "only one of -s, -S, -v, or -z allowed");
> +	return 1;
> +    }

In retrospect it might've been better to have a single '-x foo' output
that could be '-x zle_buffer_stack', '-x parameter=foo' (sets $foo), '-x
history', etc..  (Or, come to think of it, all these should have been
exposed as things that can be |ed or >ed to, so that other things beside
'print' could write to them.)  But that train has left the station :-(


  reply	other threads:[~2016-01-10  0:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05  6:47 Bart Schaefer
2016-01-01  0:37 ` Daniel Shahaf [this message]
2016-01-10 18:54   ` Bart Schaefer
2016-01-10 19:40     ` Daniel Shahaf

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=20160110003755.GA6751@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --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).