unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: 52999@debbugs.gnu.org
Subject: bug#52999: 29.0.50; [PATCH v2] `eshell-eval-using-options' should follow POSIX/GNU argument conventions
Date: Tue, 04 Jan 2022 15:01:50 +0200	[thread overview]
Message-ID: <83k0ffbqo1.fsf@gnu.org> (raw)
In-Reply-To: <8c7a7765-2d40-e685-1d93-c60496a4f626@gmail.com> (message from Jim Porter on Mon, 3 Jan 2022 21:33:28 -0800)

> From: Jim Porter <jporterbugs@gmail.com>
> Date: Mon, 3 Jan 2022 21:33:28 -0800
> 
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -1060,6 +1060,9 @@ dimensions.
>  Specifying a cons as the from argument allows to start measuring text
>  from a specified amount of pixels above or below a position.
>  
> +---
> +** 'eshell-eval-using-options' now follows POSIX/GNU argument syntax conventions.

This is too terse: we cannot assume that everyone knows what does
"POSIX/GNU argument syntax conventions" stand for.  Especially since
you didn't even say "command-line arguments", just "arguments".
Please make the entry more informative.

And why don't people who propose and install changes in Eshell also
update the Eshell manual?  That the manual in its current shape leaves
a lot to be desired is not a justification to leave it that way.  We
will never improve that manual unless we start adding useful stuff to
it, one small piece at a time.

>  (ert-deftest test-eshell-eval-using-options ()
>    "Tests for `eshell-eval-using-options'."
> +  ;; Test short options.
>    (eshell-eval-using-options
> -   "sudo" '("-u" "root" "whoami")
> -   '((?u "user" t user "execute a command as another USER")
> -     :parse-leading-options-only)
> -   (should (equal user "root")))
> +   "ls" '("-a" "/dev/null")
> +   '((?a "all" nil show-all
> +         "do not ignore entries starting with ."))
> +   (should (eq show-all t))
> +   (should (equal args '("/dev/null"))))

Can these tests be made less platform-specific?  For example, not all
the supported platforms have /dev/null, and we have a portable
abstraction for it.

> +   "sudo" '("-u" "root" "whoami")
> +   '((?u "user" t user "execute a command as another USER")
> +     :parse-leading-options-only)
> +   (should (equal user "root"))
> +   (should (equal args '("whoami"))))
> +  (eshell-eval-using-options
> +   "sudo" '("--user" "root" "whoami")
> +   '((?u "user" t user "execute a command as another USER")
> +     :parse-leading-options-only)
> +   (should (equal user "root"))
> +   (should (equal args '("whoami"))))
> +  (eshell-eval-using-options
> +   "sudo" '("emerge" "-uDN" "world")
> +   '((?u "user" t user "execute a command as another USER"))
> +   (should (equal user "DN"))
> +   (should (equal args '("emerge" "world"))))
> +  (eshell-eval-using-options
> +   "sudo" '("emerge" "-uDN" "world")
> +   '((?u "user" t user "execute a command as another USER")
> +     :parse-leading-options-only)
> +   (should (eq user nil))
> +   (should (equal args '("emerge" "-uDN" "world")))))

And here, sudo and whoami don't necessarily exist, so something should
be done about that, I think.

Thanks.





  reply	other threads:[~2022-01-04 13:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04  1:36 bug#52999: 29.0.50; [PATCH] `eshell-eval-using-options' should follow POSIX/GNU argument conventions Jim Porter
2022-01-04  5:33 ` bug#52999: 29.0.50; [PATCH v2] " Jim Porter
2022-01-04 13:01   ` Eli Zaretskii [this message]
2022-01-04 21:09     ` bug#52999: 29.0.50; [PATCH v3] " Jim Porter
2022-01-05 14:50       ` Eli Zaretskii
2022-01-06  0:48         ` Jim Porter
2022-01-06 12:31           ` Eli Zaretskii
2022-01-08 19:58             ` Jim Porter
2022-01-08 20:10               ` Eli Zaretskii
2022-01-12 15:00           ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83k0ffbqo1.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=52999@debbugs.gnu.org \
    --cc=jporterbugs@gmail.com \
    /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.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).