Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CLI description lines when parsing parameters #150

Open
tensorush opened this issue Feb 23, 2025 · 1 comment
Open

Support CLI description lines when parsing parameters #150

tensorush opened this issue Feb 23, 2025 · 1 comment

Comments

@tensorush
Copy link
Contributor

tensorush commented Feb 23, 2025

Hi, I was wondering if it's possible to support skipping cli description lines before parsing parameters?

const PARAMS = clap.parseParamsComptime(
    \\my-package-name - My Package Description [v0.1.0]
    \\
    \\-o, --opt <u8>   Optional argument (default: 3)
    \\-h, --help       Display help
    \\<str>            Positional argument
    \\
);
@Hejsil
Copy link
Owner

Hejsil commented Feb 23, 2025

It's not really something I want to bake into parseParamsComptime specifically. Seems pretty specific. Maybe in the future there is a function called parseHelp that parses an entire help message and not just the parameters.

What you can do as a workaround is something like this:

const help_description =
    \\my-package-name - My Package Description [v0.1.0]
    \\
;

const help_parameters =
    \\-o, --opt <u8>   Optional argument (default: 3)
    \\-h, --help       Display help
    \\<str>            Positional argument
    \\
;

const help_full = help_description ++ help_parameters;

const patameters = clap.parseParamsComptime(help_parameters);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants