-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Builder and clap_derive should be WYSIWYG #2808
Copy link
Copy link
Closed
Labels
A-helpArea: documentation, including docs.rs, readme, examples, etc...Area: documentation, including docs.rs, readme, examples, etc...C-bugCategory: bugCategory: bugM-breaking-changeMeta: Implementing or merging this will introduce a breaking change.Meta: Implementing or merging this will introduce a breaking change.S-waiting-on-designStatus: Waiting on user-facing design to be resolved before implementingStatus: Waiting on user-facing design to be resolved before implementing
Milestone
Metadata
Metadata
Assignees
Labels
A-helpArea: documentation, including docs.rs, readme, examples, etc...Area: documentation, including docs.rs, readme, examples, etc...C-bugCategory: bugCategory: bugM-breaking-changeMeta: Implementing or merging this will introduce a breaking change.Meta: Implementing or merging this will introduce a breaking change.S-waiting-on-designStatus: Waiting on user-facing design to be resolved before implementingStatus: Waiting on user-facing design to be resolved before implementing
Rust Version
1.55.0
Affected Version of clap
v3.0.0-beta.4
Expected Behavior Summary
Args are ordered as I declare them
Actual Behavior Summary
Args are sorted, without any exception (exceptions are common)
Context
DeriveDisplayOrderis a very popular flag to turn on. When further researching this, it is popular across CLIs and even when args are sorted, its one manually to allow exceptions.rgis one major exception for thisI chalk this up to
rgbeing an exceptional case in its scope and design and being limited by clap2's lack ofhelp_heading.Trade offs
Current Sorting Implementation
help_heading(ierg)--no-flags with their positive versions--helpand--versionwhich are generally left unsortedDeriving Order
#[clap(flatten)]Survey of CLIs
Sorted
rg--helpand--version(uses clap, author confirmed its intentional)tokei--helpand--version(uses clap)ls--help/--versiondf--help/--versionlessno-variantsCustom
cargobatfddeltahyperfinersyncvimchmodno-variants would not be sortedmountcurlwgetiptablestraceroutegrepfind(mostly sorted but there are exceptions(List of commands was inspired by prior Rust command list, some off the top of my head, and a random 50 linux command list I found. I only did a random sampling of the GNU CoreUtils though)