Skip to content

is there a way to parse "subcomand" or composite options? #467

@Raffaello

Description

@Raffaello

definition of "subcomand"

it is like an argument and then there are following arguments based on the previous argument. Basically a tree of options rather than just a list.
is this possible or cxx options will do only the root level of the tree (a list of options)?

  • a
    |
    a1
    a2
    -b
    |
    b1
    b1

exagmple of the tree options: (all valids)

myprog a a1
myprog a a2
myprog b b1
myprog b b2

also this will need to have a tree help section:

myprog a --help
myprog b -h

definition of composite options:

a complex option for e.g.:

(basic example)

-a[0-9]<b|c>

it means parsing -a with a required number between 0-9 (so that has an int value in terms of cxxpotionsthen it must have abor ac` to specify something on that previous argument, and eventually even a further one, etc...

it could be created by the user crafting for each options the dependent logic, so basically cxxopts, but if the cxxopts will do it would be a lot better as otherwise it is not really useful. Becase also it is connected to the help, makes the .help() totally useless...

this could be somehow as well designed as a dependent options:

Help section:

-a[0-9] : do the 'a' options, must specified also -b or -c when using -a[n], -b is default.
-b : do the 'b' option. must be used with -a[n]
-c : do the 'c' option. must be used with -a[n]

so from the cli:

myprog -a1 -c #as a dependent option
myprog -a1c   #as a composite option

the -a1c if it is like GNU options might work, but still the -c dependency to -a` should be specified.


is it possible to add these kind of features?

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