[Bug 43560] New: Convert misc/cronjobs/update_totalissues.pl to the Getopt::Long::Descriptive convention (see bug 43546)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43560 Bug ID: 43560 Summary: Convert misc/cronjobs/update_totalissues.pl to the Getopt::Long::Descriptive convention (see bug 43546) Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: jake.deery@openfifth.co.uk, robin@catalyst.net.nz Target Milestone: --- Convert the plain Getopt::Long option parsing in misc/cronjobs/update_totalissues.pl to Koha::Script->describe_options, per the convention established by bug 43546. This script has two separate mutually-exclusive option pairs, each currently enforced with its own hand-rolled check after parsing (setting a deferred $want_help flag rather than dying immediately): - --since / --interval - --use-items / --incremental Depends on bug 43557 (declarative mutually-exclusive option support in Koha::Script->describe_options), so both pairs can be declared rather than reimplemented as post-parse checks. Test plan: 1. misc/cronjobs/update_totalissues.pl --help Confirm the description and all options are documented. 2. For each of the two pairs, confirm supplying both options together is still rejected as mutually exclusive, and each option still works correctly on its own. 3. koha-qa.pl passes for the changed file. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43560 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |43557 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43557 [Bug 43557] Add declarative mutually-exclusive option support to Koha::Script->describe_options -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43560 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 206177 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206177&action=edit Bug 43560: Convert update_totalissues.pl to the Getopt::Long::Descriptive convention Convert the plain Getopt::Long option parsing to Koha::Script->describe_options, per the convention established by bug 43546. --since/--interval and --use-items/--incremental are declared via the exclusive support added on bug 43557, replacing the two hand-rolled "these are mutually exclusive" print+deferred-help checks. Also adds two Params::Validate callbacks (bug 43557's motivating use case for leaning on Getopt::Long::Descriptive's own validation machinery rather than hand-rolled checks): - --progress must be a positive integer. Previously an unchecked --progress 0 (or negative) would crash later with Perl's own "Illegal modulus zero" once the item/stats loop reached the modulo check, instead of failing immediately with a clear error. - --interval must be a number with an optional h/d/w/m/y suffix. Previously a malformed value (e.g. --interval abc) silently matched the parsing regex with an empty number, i.e. "subtract 0 of a day", and processed everything rather than failing. The "you must specify --use-stats and/or --use-items" check is an inclusive-or, not a mutual exclusion, so it has no declarative home in describe_options; kept as a plain post-parse check via $usage->die(), using the same short usage text every other error here now uses (the script previously dumped its full manual page via pod2usage(-verbose=>2) for every error, not just --man). This script has real POD already, so --man (added for free by describe_options) is genuinely useful here, unlike some of the other scripts converted so far. Test plan: 1. update_totalissues.pl --help / --man Confirm the description, all options, and the full manual page. 2. update_totalissues.pl (no options) Rejected: must specify --use-stats and/or --use-items. 3. update_totalissues.pl --use-stats --since X --interval Y Rejected: mutually exclusive. 4. update_totalissues.pl --use-items --incremental Rejected: mutually exclusive. 5. update_totalissues.pl --use-stats --progress 0 Rejected: must be a positive integer. 6. update_totalissues.pl --use-stats --interval abc Rejected: must be a number with an optional h/d/w/m/y suffix. 7. update_totalissues.pl --use-stats --test --interval 30d and --use-items --test both run to completion as before. 8. koha-qa.pl passes. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43560 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org