See Original text in context
The GENERATE-USAGE
subroutine should accept a Callable
representing the MAIN
subroutine that didn't get executed because the dispatch failed. This can be used for introspection. All the other parameters are the parameters that were set up to be sent to MAIN
. It should return the string of the usage information you want to be shown to the user. An example that will just recreate the Capture
that was created from processing the arguments:
sub GENERATE-USAGE(, |capture)
You can also use multi subroutines to create the same effect:
multi sub GENERATE-USAGE(, :!)multi sub GENERATE-USAGE(, |capture)
Note that the dynamic variable &*GENERATE-USAGE
is available to perform the default usage message generation so you don't have to reinvent the whole wheel if you don't want to.