date: `iso-8601` argument format discrepancy
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
The coreutils version currently accepts more argument option-value formats than that of the GNU version:
GNU:
-I[FMT], --iso-8601[=FMT] output date/time in ISO 8601 format...
coreutils:
-I, --iso-8601 [<FMT>] output date/time in ISO 8601 format...
This means the following arguments are accepted by coreutils but not GNU:
date -I=secondsdate -I secondsdate --iso-8601 seconds
GNU will treat =seconds as the value in the first one, and treat seconds as the positional argument [+FORMAT] in the next two.
coreutils will also reject some that are accepted by GNU since it will take the positional argument as the argument value, e.g. date -I 05091009:
error: invalid value '05091009' for '--iso-8601 [<FMT>]'
[possible values: date, hours, minutes, seconds, ns]
This cannot be simply fixed by setting require_equals for the clap argument, since it would also preclude the correct syntax -Iseconds. There probably are more examples of this discrepancy in coreutils (please comment below).
This is a known limitation in clap, and I have commented in this clap issue and made a fix PR.
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 with the date command's -I/--iso-8601 argument parsing and compare the GNU examples in the issue with clap issue #3030 and PR #5489. Done means the listed argument forms behave like GNU, including preserving the valid -Iseconds syntax.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100