https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43548
--- Comment #2 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 206082 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206082&action=edit Bug 43548: Add --man and positional-argument support to Koha::Script->describe_options Converting runreport.pl (next commit) surfaced two gaps in the describe_options convention introduced by bug 43546: - runreport.pl previously had --help (brief), --man (full Pod::Usage manual, since its POD is substantial), and --help+--verbose (also full manual). The new convention's --help covers the first case, but had no equivalent to --man. Rather than reinvent that per-script, --man is now added automatically alongside --help: it prints the calling script's own POD in full (Pod::Usage -verbose 2, defaulting to $0) and exits. --help+--verbose no longer triggers the full manual; --verbose reverts to its own, unrelated meaning of execution verbosity. Scripts using describe_options get --man for free going forward. - A positional-argument requirement (like runreport.pl's report ID(s)) has no per-option 'required' flag to declare it with. Left as manual post-parse validation, it's exactly the kind of ad hoc, unenforced, unparseable check bug 43546 exists to replace for named options -- it would just have nicer error formatting. describe_options now accepts a declarative 'args' key (in the same trailing hashref as 'epilog'), e.g. C<args =\> { min =\> 1, name =\> 'reportID', variadic =\> 1 }>, enforced by describe_options itself with the same consistent error/usage output as a missing required option. This also gives static tooling (e.g. the koha-plugin-crontab plugin, which reads script source rather than executing it) a literal marker for a required positional argument, the same way it already reads 'required =\> 1' for named options. describe_options also returns ($opt, $usage) in list context (unchanged in scalar context) for any post-parse validation 'args' doesn't cover. Test plan: 1. prove t/Koha/Script.t 2. koha-qa.pl passes for Koha/Script.pm (--man and args are exercised functionally in the next commit, which converts runreport.pl to use them) Co-Authored-By: Claude Sonnet 5 <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
