Invalid short optional option values
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Currently it is not possible to specify -oval optional option value syntax, where it forbids the spaced -o val syntax because the value is ambiguous as it could be a following positional argument instead. In clap, require_equals handles the long form case, i.e. --option=val, but specifying it errs the -oval form since it affects the short form too, requiring -o=val which is not what we want. This is documented in https://github.com/clap-rs/clap/issues/3030.
In summary, clap by default supports the following optional option value forms:
--long--long=value--long value-s-s value-s=value-svalue
With requires_equals(true):
--long--long=value-s-s=value
What we actually want:
--long--long=value-s-svalue‼️
This affects several coreutils (non-exhaustive, please comment if more):
date -I(#6387)pr -e/-i/-n/-s/-S(#10302)od -w(#10725)
I have tried to PR clap a new feature require_no_space to support the last form, but it has been rejected because 'we have not fully decided on a direction for this'. As it is currently, the issues are unfixable.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the referenced clap issue #3030 and rejected PR #6247 to understand the unresolved option-parsing direction. Then inspect the affected coreutils issues, including #6387, #10302, and #10725; the work is done when the desired -svalue behavior is supported without allowing the spaced short-option form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100