https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44126
Bug ID: 44126
Summary: Koha::Script->describe_options: allow scripts to
declare deprecated, ignored options
Initiative type: ---
Sponsorship ---
status:
Product: Koha
Version: Main
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P5 - low
Component: Command-line Utilities
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
CC: [email protected], [email protected]
Target Milestone: ---
Scripts converted to Getopt::Long::Descriptive (see bug 43546) now exit 1 on
any unknown option. Plain Getopt::Long only printed an "Unknown option"
warning, and scripts that did not check the return value of GetOptions carried
on regardless.
Where a script has dropped an option in the past (for example
update_totalissues.pl and --commit, removed in 24.11), existing cron jobs that
still pass it used to keep working with a warning. After conversion they exit 1
before doing any work, and since cron lines commonly redirect output to
/dev/null, the failure is silent.
This bug adds an opt-in 'deprecated_options' key to the meta hash of
Koha::Script->describe_options. Each listed option (with or without a value) is
stripped from @ARGV before parsing and a deprecation warning is printed to
STDERR, in the same way as the existing legacy single-dash compatibility shim.
Every other unknown option stays fatal, so typos on destructive scripts are
still caught.
Test plan:
1. Apply the patch and run prove t/Koha/Script.t
2. Confirm the new tests pass: a declared deprecated option is ignored with a
warning, with and without a value (--foo, --foo=1, --foo 1), and an undeclared
unknown option still exits 1.
--
You are receiving this mail because:
You are the assignee for the bug.
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/