Help language development. Donate to The Perl Foundation

CLI::Help zef:lizmat last updated on 2022-09-26
[![Actions Status](](


CLI::Help - add -h / --help parameters to your script


proto sub MAIN(|) {*}

sub handler($text, @subsections, :$verbose) {
    say "Help for foo @subsections";
    say $text;
    say "Verbose version" if $verbose;
use CLI::Help %?RESOURCES, &MAIN, &handler;

use CLI::Help %?RESOURCES, &MAIN, &handler, 'long-only';


CLI::Help adds a `multi sub` candidate to the `&MAIN` function in your script, that will trigger if the script is called with `-h` or `--help` named arguments **only**, and any positional arguments.

For instance, in the [App::Rak]( distribution, which provides a `rak` CLI, calling `rak --help` will result in something like:

$ rak --help
rak - a CLI for searching strings in files and more

And calling `rak --help --verbose`

$ rak --help --verbose
rak - a CLI for searching strings in files and more

Provided by App::Rak - 0.0.14 by Elizabeth Mattijsen,
  implemented in the Raku® Programming Language 6.d,
  running on Rakudo™ 2022.06.55, built on Moar 2022.06.2.

Suggestions / bug reports / general comments are welcome at

Thank you for using rak!

By specifying a true value as the 4th argument in the `use` statement, will cause only `--help` to trigger the candidate.


Elizabeth Mattijsen <[email protected]>

Source can be located at: . Comments and Pull Requests are welcome.

If you like this module, or what I’m doing more generally, committing to a [small sponsorship]( would mean a great deal to me!


Copyright 2022 Elizabeth Mattijsen

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.