Skip to content

CLI argparsing DSL #660

@refaktor

Description

@refaktor

From the Lobste.rs thread:

So regarding argparsing: It's a spectrum and everything has tradeoffs, additionally it's a matter of taste. Take python for example. You can construct quite complex parsers, but it's verbose. Still way better than what you need to do in bash. On the other end of the spectrum, we have something like Raku, which does everything for you automagically, but robs you of certain freedoms, it also doesn't really follow the default unix-conventions, if I recall correctly, I'm not sure though. I think ideal would be some sort of DSL that allows for absolute minimal syntax for the common cases, and still allows you to expand for more complex examples. E.g.: to just have boolean flags, argument flags, i.e. flags with additional value, and positional arguments you should have to write nearly nothing. To have modes (cargo build, cargo run), you should not need much more. To restrict the valid values, to add help-strings or to have flags with multiple arguments, you could then use more elaborate syntax.

https://lobste.rs/s/vw12iy/when_if_is_just_function#c_eyoih5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions