CLI::Version
NAME
CLI::Version - add -V / --version parameters to your script
SYNOPSIS
proto sub MAIN(|) {*}
use CLI::Version $?DISTRIBUTION, &MAIN;
# alternately:
use CLI::Version $?DISTRIBUTION, proto sub MAIN(|) {*}
DESCRIPTION
CLI::Version adds a multi sub
candidate to the &MAIN
function in your script, that will trigger if the script is called with -V
or --version
arguments only.
For instance, in the App::Rak distribution, which provides a rak
CLI, calling rak -V
will result in something like:
$ rak -V
rak - based on App::Rak 0.0.2, running Raku 6.d on Rakudo 2022.06
If the candidate is triggered, it will exit with the default value for exit
(which is usually 0).
IMPLEMENTATION NOTES
Due to the fact that the $?DISTRIBUTION
and &MAIN
of the code that uses this module, can not be obtained by a public API, it is necessary to provide them in the use
statement. This need may disappear in future versions of the Raku Programming Language.
AUTHOR
Elizabeth Mattijsen [email protected]
Source can be located at: https://github.com/lizmat/CLI-Version . 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 AND LICENSE
Copyright 2022 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.