zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] coding practice in examples (-- with globs mostly)
Date: Tue, 31 Dec 2019 17:16:38 +0000	[thread overview]
Message-ID: <20191231171638.en6olco722w4ldcc@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20191231091618.v2erkblkwkiy3i5a@chaz.gmail.com>

Stephane Chazelas wrote on Tue, Dec 31, 2019 at 09:16:18 +0000:
> Hello, I've spotted a few cases in the doc of things like "ls *"
> instead of "ls -d -- *".
> 
> While that's something one could do interactively when they know
> how the files are named and their nature, that's bad practice in
> scripts. As a reference manual, IMO, the zsh documentation
> should show "the right way".

+1 and thanks for the patch.  Two small suggestions:

> {+++ b/Doc/Zsh/builtins.yo+}
> @@ -1258,7 +1258,11 @@ If given together with tt(-o) or tt(-O), sorting is performed
>  item(tt(-l))(
> -Print the arguments separated by newlines instead of spaces.
> +Print the arguments separated by newlines instead of spaces. Note:
> +if the list of arguments is empty, tt(print -l) as opposed to
> +tt(print -C1), still outputs one empty line; tt(print -rC1 --
> +"$list[@]") is a more canonical way to print an arbitrary list of
> +arguments, one per line.

Suggest not to mention the solution before the problem:

+Note: if the list of arguments is empty, tt(print -l) will still output one
+empty line.  To print a possibly-empty list of arguments one per line, use
+tt(print -C1), as in `tt(print -rC1 -- "$list[@]")'.

> {+++ b/Doc/Zsh/contrib.yo+}
> @@ -4422,10 +4422,11 @@ For example, to get a long tt(ls) listing of all plain files in the
> current directory or its subdirectories:
> 
> example(autoload -U zargs
> zargs -- **/*(.) -- ls [--l)-] {+-ld --)+}
> 
> Note that `tt(-)tt(-)' is used both to mark the end of the var(option)
> list and to mark the end of the var(input) [-list,-] {+list (and here also to mark
> the end of the option list for tt(ls)),+} so it must appear twice
> whenever the var(input) list may be empty.  If there is guaranteed to be
> at least one var(input) and the first var(input) does not begin with a
> `tt(-)', then the first `tt(-)tt(-)' may be omitted.

I think the text could be a little hard to follow, since there are three
«--» but it talks about "both" and then mentions the third in an
afterthought.  Would you prefer to change the incumbent text as well?
You're not limited to adding parentheticals.

Cheers,

Daniel

  reply	other threads:[~2019-12-31 17:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-31  9:16 Stephane Chazelas
2019-12-31 17:16 ` Daniel Shahaf [this message]
2020-01-01 12:00   ` Stephane Chazelas
2020-01-01 12:52     ` Daniel Shahaf
2020-01-01 21:18       ` [PATCH v2] " Stephane Chazelas

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=20191231171638.en6olco722w4ldcc@tarpaulin.shahaf.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).