-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Lifetimes of App, Arg, ArgGroup: removing or relaxing #1041
Copy link
Copy link
Closed
Labels
A-builderArea: Builder APIArea: Builder APIC-enhancementCategory: Raise on the bar on expectationsCategory: Raise on the bar on expectationsE-mediumCall for participation: Experience needed to fix: Medium / intermediateCall for participation: Experience needed to fix: Medium / intermediateM-breaking-changeMeta: Implementing or merging this will introduce a breaking change.Meta: Implementing or merging this will introduce a breaking change.
Milestone
Metadata
Metadata
Assignees
Labels
A-builderArea: Builder APIArea: Builder APIC-enhancementCategory: Raise on the bar on expectationsCategory: Raise on the bar on expectationsE-mediumCall for participation: Experience needed to fix: Medium / intermediateCall for participation: Experience needed to fix: Medium / intermediateM-breaking-changeMeta: Implementing or merging this will introduce a breaking change.Meta: Implementing or merging this will introduce a breaking change.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Affected Version of clap
All 2.x. Breaking API change
Expected Behavior Summary
I want to decouple groups of options to several structs. I want to have a pair functions: one that adds arguments to an App with generated names, one that generates a structure with the added arguments.
Actual Behavior Summary
Uncompilable: the types don't allow to create String in a function and return a borrow.
Sample code
Proposed solution
Since clap is dependent on its speed it's probably not an option to force 'String' instead of '&str'. However I think Cow should give enough options.
Alternative for me
Create a struct
AParseto contain the owned strings, split the functionargumentsin two parts. A can generate anAParsestruct before creating the App object.