by OptionOfT · 12mo ago · 0 comments
Sometimes you see curl -sSLfO. Please, use the long form. It makes life easier for everybody. It makes it easier to verify, and to look up. Finding --silent in curl's docs is easier than reading through every occurrence of -s.
curl --silent --show-error --location --fail --remote name https://example.com/script.sh
Obligatory xkcd: https://xkcd.com/1168/> for-docs "ls -lrth /mnt/data"
ls -l --reverse -t --human-readable -- /mnt/data
(I'd put in an option to put the options alphabetically too)
Kind of like positing a master `dry-run` command as opposed to different commands implementing `--dry-run` arguments.
I did something like this:
_command="sed" _option="n"
man -- "${_command}" | sed --quiet --expression "s/^ -${_option}.*, //p"
Then I realised that a bit of logic is needed (or more complicated regexp) to deal with some exceptions and moved onto something else.Dumb trick: Search prefixed with 2 spaces.
man curl
/ -s
Yields exactly one hit on my machine. In the general case, you may have to try one and two spaces.The shorthands are for when typing it at a console and the long form versions should be used in scripts.
also, putting it out long-form you might catch some things you do out of habit, rather than what's necessary for the job.