curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Two-letter options?

From: Timothe Litt <litt_at_acm.org>
Date: Fri, 11 Mar 2022 07:24:26 -0500

On 11-Mar-22 04:38, Daniel Stenberg via curl-users wrote:
> Hello!
>
> Over on Twitter, Leah Neukirchen brought an interesting idea for curl
> command line options.
>
> We have basically run out of single-letter options (practically
> speaking only -W, -5, -7, -8, -9 are left usused), making all new
> options forced to be long versions only. Like the newly introduced
> --remove-on-error [1].
>
> The proposal is that we "repurpose" using *two* boolean single-letter
> options and give them a unique meaning. For example, we can make "-ff"
> to mean something, or "-ss", "-aa" etc.
>
> Using this method we could make -ff equal to --remove-on-error while
> still having -f mean --fail.
>
> There is for sure a small set of users somewhere that use "-ff"
> already, that now are just setting --fail twice, and those would be
> negatively affected by such a change.
>
> Another, maybe slightly uglier but safer as it wouldn't risk any
> existing duplicate option using users, way to introduce two-letter
> options is to use one of the currently unused characters. -f9 could be
> made to mean --remove-on-error. The use of an adjacent '9' could then
> be used to extend any single-letter option to make a two-letter
> option. Or we could prefix it with a '9' and make a new family of ~60
> available two-letter options like '-9f' (and '9' here could of course
> be 'W' instead etc).
>
> Thoughts?
>
> [1] =
> https://daniel.haxx.se/blog/2022/03/11/remove-leftovers-on-curl-error/
>
If ease of use, rather than yet more cryptic abbreviations for the
insiders is a goal, perhaps add bash command completion to the standard
kit?  command completion is helpful to both casual users and experts. 
bash is very widely used, so it seems a good target.

script scripts/completion.pl looks like it will extract known options
from the help and generate a completion scrip.  It claims to support
fish and zsh.  Adding bash would require some work, but once done,
should be low maintenance.

Alternatively, a quick search turned up
https://github.com/scop/bash-completion/blob/master/completions/curl ,
which appears to work with bash 5.1, though not with 4.4.  I haven't
looked to see how, er, 'complete' it is in covering all the curl options
or how creative it is in making related suggestions.  Last commit is
fairly recent.

Anyhow, it seems like a reference point for updating completion.pl.  Or
it could be imported into the curl tree/kit build.

Completion doesn't add to the per-option documentation.  But it does
reduce keystrokes.

If you stick with just adding option aliases, I'm more inclined toward
--<medium-length-abbrev> than -Wx.  -<digit> doesn't seem like a good
prefix.

Another cryptic option choice would be a suffix - e.g. -X+, where '+'
could add-to or alter the meaning of X.  Not wedded to '+' - and of
course, this opens the ability to have more than one suffix for yet more
expansion.  -X-, -X^, ...  You could even assign mnemonics to the
suffixes - e.g. + is "more of", - is less - I'll leave -X∫ (the integral
sign)'s mnemonic to someone truly creative :-)

It seems better to simplify use than to add cryptic shortcuts. Of course
with the energy in this group, you could do both :-(

Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-03-11