Currently, to get a field from a potential subcommand one has to write the following boilerplate piece of code
match parseResults.TryGetSubCommand() with
| Some (SC_a args) -> args.GetResult SC_a_field
| _ -> None
In my case, I am populating an internal configuration object from cli fields where a lot of them are subcommand ones, making such match cases ugly duplicates.
Expected behavior
I believe it would be useful to have a function which (using reflective ways) can get inner subcommand fields type-safely. Seems like an intuitive api addition to me.
Actual behavior
One has to write a match expression as described above.
Known workarounds
A function such as:
TryGetResultFromSubCommand : parseResults: ParseResults<'TopLevelArgs> -> scType: (ParseResults<'SCArgs> -> 'TopLevelArgs) -> innerOption:Expr<('Field -> 'SCArgs)> -> 'Field option
can be created and used conveniently for such queries, enforcing proper types
Description
Currently, to get a field from a potential subcommand one has to write the following boilerplate piece of code
In my case, I am populating an internal configuration object from cli fields where a lot of them are subcommand ones, making such match cases ugly duplicates.
Expected behavior
I believe it would be useful to have a function which (using reflective ways) can get inner subcommand fields type-safely. Seems like an intuitive api addition to me.
Actual behavior
One has to write a match expression as described above.
Known workarounds
A function such as:
TryGetResultFromSubCommand : parseResults: ParseResults<'TopLevelArgs> -> scType: (ParseResults<'SCArgs> -> 'TopLevelArgs) -> innerOption:Expr<('Field -> 'SCArgs)> -> 'Field option
can be created and used conveniently for such queries, enforcing proper types