Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clap_derive: support fixed arrays as shortcut for number_of_values = N #1682

Open
CreepySkeleton opened this issue Feb 9, 2020 · 5 comments
Assignees
Labels
A-derive Area: #[derive]` macro API C-enhancement Category: Raise on the bar on expectations S-waiting-on-design Status: Waiting on user-facing design to be resolved before implementing

Comments

@CreepySkeleton
Copy link
Contributor

CreepySkeleton commented Feb 9, 2020

Transferred from: TeXitoi/structopt#349

It would be even better if fixed sized arrays or tuples with different value types would be supported directly:

#[derive(Clap)]
struct Args {
    #[clap(long)]
    range: [u32; N], // implies `required = true` and `number_of_values = N` 

    #[clap(long)]
    range: Option<[u32; N]>, // `number_of_values = N` 
}
@CreepySkeleton CreepySkeleton added A-derive Area: #[derive]` macro API T: new feature labels Feb 9, 2020
@CreepySkeleton CreepySkeleton added this to the 3.1 milestone Feb 9, 2020
@pksunkara
Copy link
Member

Could you create a separate issue for the tuples?

@cecton
Copy link
Contributor

cecton commented Mar 26, 2020

Yeah actually having something automatic for tuples would solve my issue as I won't have to fight with Vec. (But I still believe the current impl of Vec is wrong but I didn't read your answer yet.)

@CreepySkeleton
Copy link
Contributor Author

This change would be breaking if implemented after 3.0 is out, so triaging for 3.0

@CreepySkeleton CreepySkeleton modified the milestones: 3.1, 3.0 Apr 18, 2020
@ldm0 ldm0 self-assigned this Mar 13, 2021
@ldm0 ldm0 changed the title clap_derive: support fixed arrays as shortcur for number_of_values = N clap_derive: support fixed arrays as shortcut for number_of_values = N Mar 25, 2021
@pksunkara pksunkara removed the W: 3.x label May 26, 2021
@pksunkara pksunkara removed this from the 3.0 milestone Jun 16, 2021
@epage epage added C-enhancement Category: Raise on the bar on expectations and removed T: new feature labels Dec 8, 2021
@epage
Copy link
Member

epage commented Dec 9, 2021

@epage epage added the S-waiting-on-mentor Status: Needs elaboration on the details before doing a 'Call for participation' label Dec 9, 2021
@ldm0 ldm0 self-assigned this Apr 26, 2022
@epage epage added S-waiting-on-design Status: Waiting on user-facing design to be resolved before implementing and removed S-waiting-on-mentor Status: Needs elaboration on the details before doing a 'Call for participation' labels Nov 8, 2022
@epage
Copy link
Member

epage commented Nov 8, 2022

I've pushed this back to design as we'd need to figure out how people can opt-out of this behavior in case a value parser wants to output one of these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-derive Area: #[derive]` macro API C-enhancement Category: Raise on the bar on expectations S-waiting-on-design Status: Waiting on user-facing design to be resolved before implementing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants