Skip to content

Support more attributes #108

Closed
Closed
@fasterthanlime

Description

@fasterthanlime

@epage suggested this on Reddit:

Instead of free-form attributes, what if attributes were const-expressions that evaluated to a value that gets stored? It seems like those could be instropected like anything else in facet.

use facet_args::prelude::*;

#[derive(Facet)]
struct Args {
    #[facet(Positional)]
    path: String,

    #[facet(Named, Short('v'))]
    verbose: bool,

    #[facet(Named, Short('j'))]
    concurrency: usize,
}
Maybe you could event do a hack like clap's where Name = Value gets treated as Name(Value)

use facet_args::prelude::*;

#[derive(Facet)]
struct Args {
    #[facet(Positional)]
    path: String,

    #[facet(Named, Short = 'v')]
    verbose: bool,

    #[facet(Named, Short = 'j')]
    concurrency: usize,
}

I'm not sure exactly how this would work, but I'm willing to try.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions