Paul Poulain schreef op di 21-10-2014 om 09:53 [+0200]:
I've 2 strong opinions: * if the script does something that can't be rolled back, there *must* be a of validation. for example "delete_bibs_without_items.pl" must not delete anything without warning. This warning can be something like "you're about to delete 100000 bibliographic records. Are you sure Y/N", unless the script is run with a parameter (delete_bibs_without_items.pl -y)
I quite like that idea actually. We'd also want some tests for running within a TTY etc so we don't end up blocking forever, but that's not hard.
Additional question: some CLI are made for being run from cron. In this case, no information should be printed unless something goes wrong. SO: by default, should scripts be silent: * no parameters = silent mode * -v = some informations * -vv (or -v 2, or --very-verbose, I don't care ;-) ) = verbose mode
-vvvvv is the standard way of doing such things, and very easy to do with Getopt::Long. I think this scheme is the best idea for things that are designed to be cron'ed, as opposed to:
or should there be an explicit "silent mode": * -s parameter = silent mode * no parameter = some informations * -v = verbose mode
-- Robin Sheat Catalyst IT Ltd. ✆ +64 4 803 2204 GPG: 5FA7 4B49 1E4D CAA4 4C38 8505 77F5 B724 F871 3BDF