Examples of "optional option arguments"?

Ulysse Carion
Message ID
DKIM signature
Download raw message

In "Conventions for Command Line Options", you describe "optional
option arguments". Can you give an example of a tool that supports
such an option? I'm struggling to see the use-case, and can't recall
ever having seen this in the wild.

Message ID
<CAJK=1RjWbQsxJFpEzUDA59eo3VsTVSCUbtLTahu7TZhynmBjWA@mail.gmail.com> (view parent)
DKIM signature
Download raw message
Half the various GNU utilities have at least one. Any that produce color 
output (ls, grep, etc.) have a --color option with an optional "WHEN" 
argument. ln, install, and mv have a --backup with optional CONTROL 
argument. df --output has an optional FIELD_LIST argument. mkdir, 
install, mkfifo, and mknod have --context with an optional CTX argument. 
ls and vdir have --hyperlink with an optional WHEN argument. mkdir 
--tmpdir has an optional DIR argument. rm has --interactive with an 
optional WHEN argument and --preserve-root with an optional ALL 
argument. sched has --remove with an optional HOW. od has --width with 
an optional BYTES, and it also comes with a short option version -w also 
taking optional BYTES. pr also has a whole bunch like this. I could keep 
going since GNU has so many examples, but I'll stop here!

Git has a ton of them, too. Its --exec-path option takes an optional 
path. The show command has --pretty, --notes, and --show-notes with 
optional arguments. The log command has --decorate, --branches, --tags, 
--remotes, --no-walk, --pretty, --notes, --show-notes, 
--show-linear-break, --stat, --dirstat, --submodule, --color, 
--color-moved, --word-diff, --color-words, --abbrev, --break-rewrites 
(and -B), --find-renames, --find-copies, --relative, and 
--ignore-submodules all taking optional arguments. Again, I could 
probably list a hundred more just by further exploring the man pages.

My own passphrase2pgp has --protect (-e), --expires (-x), and --pinentry 
each with an optional argument. My Enchive tool has --derive (-d) with 
an optional iteration count, as well as --pinentry and --agent.


Basically you need only grep "[=" in man pages to find them.
Export thread (mbox)