GNU bug report logs -
#34026
doc: explain long-vs-short options
Previous Next
To reply to this bug, email your comments to 34026 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#34026
; Package
coreutils
.
(Thu, 10 Jan 2019 03:48:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Thu, 10 Jan 2019 03:48:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
On (info "(coreutils) Common options")
mention that, though clearer, long options aren't always as good as short options,
$ touch --reference=~jidanni/.pcmanx /cf/pcmanx_time
touch: failed to get attributes of '~jidanni/.pcmanx/pcmanx': No such file or directory
Unless one removes the '=':
$ touch --reference ~jidanni/.pcmanx/pcmanx /cf/pcmanx_time
$
(due to the shell helping out with "~...")
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#34026
; Package
coreutils
.
(Thu, 10 Jan 2019 04:12:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 34026 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 1/9/19 7:47 PM, 積丹尼 Dan Jacobson wrote:
> On (info "(coreutils) Common options")
> mention that, though clearer, long options aren't always as good as short options,
> $ touch --reference=~jidanni/.pcmanx /cf/pcmanx_time
> touch: failed to get attributes of '~jidanni/.pcmanx/pcmanx': No such file or directory
> Unless one removes the '=':
> $ touch --reference ~jidanni/.pcmanx/pcmanx /cf/pcmanx_time
> $
> (due to the shell helping out with "~...")
The same is true for short options: 'touch -rfile' and 'touch -r file'
are almost identical, except for 'touch -r~file' and 'touch -r ~file'.
So it is NOT a case of long options not being as good as short options.
Note that bash defaults to doing ~ expansion after =, but that this is a
bash extension and is disabled by default when bash is in POSIX mode.
But not even bash can tell that you want tilde expansion if you write
the argument of a short option adjacent to the option rather than as a
separate argument. So in _that_ regards, if you want to pass as small
of an argv[] as possible, the long option form with = is BETTER than the
short option form of concatenation, if you use bash as your shell.
Spelling long options with a space instead of = is fine for all long
options that have a mandatory option, and we try to avoid long options
with optional arguments (where you have to use =). That said, I agree
that having some mention in the manual of the effects of =~ having
different behaviors depending on the shell would be helpful. Remember,
if you want tilde expansion it is best to present that option argument
as a standalone argument so that the tilde starts the word; when that is
not possible (such as for the less common case of an optional argument
to a long option), you can use $HOME/ instead of ~/, or else have to
resort to a temporary variable to perform the tilde expansion
separately, as in:
tmp=~user; touch --reference=$tmp/.pcmanx/pcmanx /cf/pcmanx_time
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#34026
; Package
coreutils
.
(Thu, 10 Jan 2019 04:24:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 34026 <at> debbugs.gnu.org (full text, mbox):
Yes do warn in the manual, as here root (so no $HOME) expected tilde
expansion... Thanks.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#34026
; Package
coreutils
.
(Fri, 11 Jan 2019 08:32:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 34026 <at> debbugs.gnu.org (full text, mbox):
severity 34026 wishlist
retitle 34026 doc: explain long-vs-short options
stop
Hello,
On 2019-01-09 9:23 p.m., 積丹尼 Dan Jacobson wrote:
> Yes do warn in the manual, as here root (so no $HOME) expected tilde
> expansion... Thanks.
I'm marking this as a wish-list item.
If we are to add a section dedicated to options parsing,
it's worth noting related discussion about using two dashes
to stop processing ( http://bugs.gnu.org/33942 ),
and some similar section in the guile manual:
https://www.gnu.org/software/guile/manual/html_node/Command-Line-Format.html
regards,
- assaf
Severity set to 'wishlist' from 'normal'
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 11 Jan 2019 08:32:02 GMT)
Full text and
rfc822 format available.
Changed bug title to 'doc: explain long-vs-short options' from 'mention that long options aren't always as good as short options'
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 11 Jan 2019 08:32:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 217 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.