GCC allows for providing arguments to sub-processes via a syntax which I would like to replicate: it uses a prefix as send this to a sub process. As an example -D is used to define a macro (ex -DDEBUG defines a macro named DEBUG).
Currently, at least to my knowledge, such usage is not supported (aside from inheriting from ArgumentParser and implementing it), which is a shame in my opinion.
There are three main ways, that I see, that this feature could be designed as:
Slightly more straight-forward to implement, likely would better represent what is happening under the hood, though it seems off to me. It also opens the door for more option related to the prefix, like not using the normal prefix chars.
GCC allows for providing arguments to sub-processes via a syntax which I would like to replicate: it uses a prefix as send this to a sub process. As an example
-D
is used to define a macro (ex-DDEBUG
defines a macro namedDEBUG
).Currently, at least to my knowledge, such usage is not supported (aside from inheriting from
ArgumentParser
and implementing it), which is a shame in my opinion.There are three main ways, that I see, that this feature could be designed as:
Argument
ArgumentParser
Modified
Argument
approachExample code:
This would however likely be harder to implement, or would, under the hood, use the second approach anyway.
Separate trait approach
Example code:
Slightly more straight-forward to implement, likely would better represent what is happening under the hood, though it seems off to me. It also opens the door for more option related to the prefix, like not using the normal prefix chars.
Hook approach
Example code:
Likely easiest to implement, and gives room for other creativity, but very hacky feeling and more code needed on the side of the user.