4 ms·
> that means we only can keep --long=x Just wondering: why `--long=x` over `--long x`?
by conaclos 4y ago
> that means we only can keep --long=x
Just wondering: why `--long=x` over `--long x`?
- grose 4y ago`--long x` is potentially ambiguous. `x` could be referring to a file if `--long` doesn't take any options, so parsing it correctly depends on this knowledge. The equals sign removes this ambiguity.
- kzrdude 4y ago--long=x supports the simultaneous --color and --color=auto usecase, i.e the value is optional. Without = it's ambiguous.
- deleted 4y ago[deleted]
- jolmg 4y agoIt also has the advantage that it works with brace expansion to specify multiple values. --long={foo,bar} becomes --long=foo --long=bar
- conaclos 4y agoWith bash/zsh the auto-completion seems missing for unknown options. While `--key file` supports auto-completion since file is just another parameter.
- kzrdude 4y agoThanks for teaching something useful!
- conaclos 4y agoActually you can expand any pattern: --option{X,Y} -> --optionX --optionY --option:{X,Y} -> --option:X --option:Y ...