[Koha-devel] Conventions for CLI scripts
Robin Sheat
robin at catalyst.net.nz
Thu Oct 23 01:04:50 CEST 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20141023/61a18600/attachment.pgp>
More information about the Koha-devel
mailing list