[Bug 43552] New: Convert misc/cronjobs/gather_print_notices.pl to the Getopt::Long::Descriptive convention (see bug 43546)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Bug ID: 43552 Summary: Convert misc/cronjobs/gather_print_notices.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 Depends on: 43546 Target Milestone: --- This is one of a set of bugs filed alongside bug 43546 (Standardize command-line scripts on Getopt::Long::Descriptive) to convert individual, commonly-used cron scripts to whatever declarative option-parsing convention that bug settles on. Depends on 43546. Current state: gather_print_notices.pl uses plain Getopt::Long (GetOptions call around line 31). No named option is required in the Getopt::Long sense. The actual mandatory input is a positional argument, not a flag: the output directory is taken from $ARGV[0] and validated around line 47 ("You must specify a valid and writeable directory..."). Separately, --csv and --ods each require exactly one --letter_code to also be given -- a cross-option constraint, not a single required flag. What this bug covers: convert the named options (--split, --html, --csv, --ods, --delimiter, --letter_code, --send, --email) to the new convention for consistency. As with runreport.pl in this same set, the positional output-directory requirement and the csv/ods-needs-one-letter_code cross-check don't map onto a simple per-option required constraint and will likely need to stay as manual post-parse validation. Test plan: - --help output covers all documented options and matches current behavior - Running with a valid output directory and various flag combinations still behaves exactly as before - Running with a missing/invalid directory, or --csv/--ods without exactly one --letter_code, still fails with the same errors as today Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43546 [Bug 43546] Standardize command-line scripts on Getopt::Long::Descriptive for safer, more consistent option handling -- 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=43552 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 206184 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206184&action=edit Bug 43552: Convert gather_print_notices.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. The mandatory output_directory is a positional argument, not a named option, so it uses the args => { min => 1 } support added on bug 43546's follow-up, replacing the hand-rolled "no reportID" style check with a consistent one. Two checks stay as post-parse code, same reasoning as the sibling bugs in this set: - output_directory must exist and be writeable: a filesystem-state check, not a CLI-shape one. - --csv/--ods must be combined with exactly one --letter_code: not a simple mutual-exclusivity pair (Koha::Script's exclusive support from bug 43557 doesn't fit), and not a single-option shape check either. --send's existing Getopt::Long negatable flag (send!) carries over directly; describe_options renders it as --[no-]send in --help for free. One minor, expected loss consistent with the other scripts converted so far: -h no longer means --help (describe_options' auto-added help is always help|?, no short letter); updated the SYNOPSIS/OPTIONS POD to stop advertising it. Test plan: 1. gather_print_notices.pl --help / --man 2. gather_print_notices.pl (no output_directory) Rejected: at least 1 output_directory argument required. 3. gather_print_notices.pl /no/such/dir Rejected: must specify a valid and writeable directory. 4. gather_print_notices.pl --csv /tmp/some-writeable-dir Rejected: --csv needs exactly one --letter_code. 5. gather_print_notices.pl /tmp/some-writeable-dir Runs to completion (default html format). 6. 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=43552 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 the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org