argparse icon indicating copy to clipboard operation
argparse copied to clipboard

Support ddoc as description for helptexts

Open gizmomogwai opened this issue 1 year ago • 4 comments

I was playing with rust/clap and one feature I really liked there was, that you can use doc-comments as an alternative to annotations to document flags/commands... Not sure that its possible to get to the doc-comments in dlang though (I found an old issue: https://github.com/dlang/dmd/pull/6872 where one of the usecases was especially commandline help generation).

gizmomogwai avatar Jan 01 '24 23:01 gizmomogwai

I think I got what you are looking for but to be sure, could you please provide more details (e.g., an example) of what you want?

andrey-zherikov avatar Jan 01 '24 23:01 andrey-zherikov

instead of

    @(NamedArgument(["aFlag"]).Description("test description"))
    bool aFlag;

it would perhaps be interesting to be able to write

    /// test description
    @(NamedArgument(["aFlag"]))
    bool aFlag;

if both variants are there, then the explicit description should win. Unfortunately I think there is no way to get to the /// information at compile time.

gizmomogwai avatar Jan 01 '24 23:01 gizmomogwai

Might be something for opend ... perhaps this feature will be "back" ported to dlang :)

gizmomogwai avatar Jan 15 '24 00:01 gizmomogwai

Yeah. I'm not sure it's implemented already but I'll definitely take a look.

andrey-zherikov avatar Jan 15 '24 12:01 andrey-zherikov