Proposal for a new coding guideline for command line scripts
Hello koha-devel, I just pushed a few minuts ago a new script in misc (bug 8376, but it doesn't matter for this mail) This script has a help that is displayed when you run it with -h. So far so good. BUT, it has no PODDOC. Not so good. I've discovered recently that we could use:
use Pod::Usage;
sub usage { pod2usage( -verbose => 2 ); exit; } <snip> usage() if $help;
That will deal with both POD and -h flag. It's used in some scripts like misc/maintenance/touch_all_biblios.pl Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ? -- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08
Paul,
I just pushed a few minuts ago a new script in misc (bug 8376, but it doesn't matter for this mail)
This script has a help that is displayed when you run it with -h. So far so good.
BUT, it has no PODDOC. Not so good.
I've discovered recently that we could use:
use Pod::Usage;
sub usage { pod2usage( -verbose => 2 ); exit; } <snip> usage() if $help;
That will deal with both POD and -h flag. It's used in some scripts like misc/maintenance/touch_all_biblios.pl
Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ?
+1 from me Regards, Jared -- Jared Camins-Esakov Bibliographer, C & P Bibliography Services, LLC (phone) +1 (917) 727-3445 (e-mail) jcamins@cpbibliography.com (web) http://www.cpbibliography.com/
Op 24-07-12 18:02, Paul Poulain schreef:
Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ?
I find this also makes it very easy to have short '--help' output, and longer '--manual' output. Robin. -- Robin Sheat Catalyst IT Ltd. ✆ +64 4 803 2204 GPG: 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
Le 24/07/2012 18:06, Robin Sheat a écrit :
Op 24-07-12 18:02, Paul Poulain schreef:
Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ?
I find this also makes it very easy to have short '--help' output, and longer '--manual' output.
Robin.
+1 for having -h|--help ouptput a brief help message and another option to have POD (not mandatory, we could just do perldoc ./myscript.pl) -- Julian Maurice <julian.maurice@biblibre.com> BibLibre
+1 Ian On Jul 25, 2012 3:07 AM, "Julian Maurice" <julian.maurice@biblibre.com> wrote:
Le 24/07/2012 18:06, Robin Sheat a écrit :
Op 24-07-12 18:02, Paul Poulain schreef:
Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ?
I find this also makes it very easy to have short '--help' output, and longer '--manual' output.
Robin.
+1 for having -h|--help ouptput a brief help message and another option to have POD (not mandatory, we could just do perldoc ./myscript.pl)
-- Julian Maurice <julian.maurice@biblibre.com> BibLibre ______________________________**_________________ Koha-devel mailing list Koha-devel@lists.koha-**community.org<Koha-devel@lists.koha-community.org> http://lists.koha-community.**org/cgi-bin/mailman/listinfo/**koha-devel<http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel> website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.**org/ <http://bugs.koha-community.org/>
On 24/07/2012 18:02, Paul Poulain wrote:
This script has a help that is displayed when you run it with -h. So far so good.
Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ?
Of course yes for: - (-h|--help) - maybe -v|--verbose if needed Claire;
+1 Chris On Jul 25, 2012 4:02 AM, "Paul Poulain" <paul.poulain@biblibre.com> wrote:
Hello koha-devel,
I just pushed a few minuts ago a new script in misc (bug 8376, but it doesn't matter for this mail)
This script has a help that is displayed when you run it with -h. So far so good.
BUT, it has no PODDOC. Not so good.
I've discovered recently that we could use:
use Pod::Usage;
sub usage { pod2usage( -verbose => 2 ); exit; } <snip> usage() if $help;
That will deal with both POD and -h flag. It's used in some scripts like misc/maintenance/touch_all_biblios.pl
Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ?
-- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08 _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
+1 Brendan On Tue, Jul 24, 2012 at 1:09 PM, Chris Cormack <chris@bigballofwax.co.nz>wrote:
+1
Chris On Jul 25, 2012 4:02 AM, "Paul Poulain" <paul.poulain@biblibre.com> wrote:
Hello koha-devel,
I just pushed a few minuts ago a new script in misc (bug 8376, but it doesn't matter for this mail)
This script has a help that is displayed when you run it with -h. So far so good.
BUT, it has no PODDOC. Not so good.
I've discovered recently that we could use:
use Pod::Usage;
sub usage { pod2usage( -verbose => 2 ); exit; } <snip> usage() if $help;
That will deal with both POD and -h flag. It's used in some scripts like misc/maintenance/touch_all_biblios.pl
Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ?
-- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08 _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
-- --------------------------------------------------------------------------------------------------------------- Brendan A. Gallagher ByWater Solutions CEO Support and Consulting for Open Source Software Installation, Data Migration, Training, Customization, Hosting and Complete Support Packages Headquarters: Santa Barbara, CA - Office: West Haven, CT Phone # (888) 900-8944 http://bywatersolutions.com info@bywatersolutions.com
Sounds good to me. Kyle http://www.kylehall.info ByWater Solutions ( http://bywatersolutions.com ) Meadville Public Library ( http://www.meadvillelibrary.org ) Crawford County Federated Library System ( http://www.ccfls.org ) Mill Run Technology Solutions ( http://millruntech.com ) On Tue, Jul 24, 2012 at 12:02 PM, Paul Poulain <paul.poulain@biblibre.com> wrote:
Hello koha-devel,
I just pushed a few minuts ago a new script in misc (bug 8376, but it doesn't matter for this mail)
This script has a help that is displayed when you run it with -h. So far so good.
BUT, it has no PODDOC. Not so good.
I've discovered recently that we could use:
use Pod::Usage;
sub usage { pod2usage( -verbose => 2 ); exit; } <snip> usage() if $help;
That will deal with both POD and -h flag. It's used in some scripts like misc/maintenance/touch_all_biblios.pl
Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ?
-- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08 _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
+1 Kind Regards, Chris On Tue, Jul 24, 2012 at 12:02 PM, Paul Poulain <paul.poulain@biblibre.com> wrote:
Hello koha-devel,
I just pushed a few minuts ago a new script in misc (bug 8376, but it doesn't matter for this mail)
This script has a help that is displayed when you run it with -h. So far so good.
BUT, it has no PODDOC. Not so good.
I've discovered recently that we could use:
use Pod::Usage;
sub usage { pod2usage( -verbose => 2 ); exit; } <snip> usage() if $help;
That will deal with both POD and -h flag. It's used in some scripts like misc/maintenance/touch_all_biblios.pl
Do we agree it's a good idea to request that for future scripts, and add this in the coding guidelines ?
-- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08 _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
participants (10)
-
Brendan Gallagher -
Chris Cormack -
Chris Nighswonger -
Claire Hernandez -
Ian Walls -
Jared Camins-Esakov -
Julian Maurice -
Kyle Hall -
Paul Poulain -
Robin Sheat