coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Priority of --help


From: Pádraig Brady
Subject: Re: Priority of --help
Date: Wed, 21 Oct 2015 15:42:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 21/10/15 13:56, Eric Blake wrote:
> On the libvirt list, the question was raised on what happens if you have
> a long command line, but then forget the arguments of an option that
> requires an argument, so you try to add --help in-place to learn them.
> For example:
> 
> $ ls --block-size --help
> ls: invalid --block-size argument '--help'
> 
> Okay, this makes sense, '--help' is appearing in the argument position,
> not as an option, so it got eaten by --block-size, and we don't get
> help.  So let's try again, by placing a filler for the option argument,
> then our real --help attempt; and since --help is idempotent, it doesn't
> matter how often it appears up front, so let's use --help as the filler:

At this stage it might be a simpler thought process
for users to just `ls --help` rather than expecting
adding another --help to work.  Also the typing it saves
is the command name vs {Up}, i.e. not much.

I'd be 60:40 against complicating the commands for that.

As for alternatives, you could:

  !!:0 --help

Or setup and alias to do that:

  alias lh='`history -p \!\!:0 --help`'

New users could use the standard: command --help,
while power users saving time could do the above.

This also works with bash >= 4.4 which now supports --help.

Also relate would be integrating `explain¹` functionality
into the man page system or whatever,
with associated shortcut alias or in .inputrc to access that.

  alias ex='`explain history -p \!\!`'

That would have the advantage of narrowing the explanation
to the options used.

thanks,
Pádraig.

¹ https://www.mankier.com/blog/explaining-shell-commands-in-the-shell.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]