[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Provide proper help output for all tools of last



Hi Andreas,

many thanks for your useful advice!  I had wondered if there was a
standard destination for help output.  The latest version (67) in the
svn repository incorporates your comments.

By the way, lastal has two new options, -F and -G, which are
undocumented in the manual and half-implemented.  I hope to finish
this within a week or so.

And thanks for Debianizing LAST!

Martin Frith
http://www.cbrc.jp/~martin/


On Wed, Sep 30, 2009 at 09:59:28AM +0200, Andreas Tille wrote:
> Hi,
> 
> when preparing the latest version of last as Debian package (here named
> last-align) I tried to provide man pages for all tools provided in the
> package to comply with Debian policy.  The easiest way to do this is
> simply using the help2man tool which produces more or less reasonable
> manpages from the output you give when using the help option
> (-h/--help).
> 
> When doing so I stumbled upon the fact that not all tools direct the
> help output to stdout but rather stderr.  This is not conform to GNU
> coding standards and thus intentionally not supported by help2man[1].
> So I did a small patch (attached) to enable output to stdout (and
> defining a -h option for lastdb which was missing).  Please feel free
> to apply this patch in your next version.
> 
> I would also be really happy if
>     last-map-probs, last-reduce-alignments, last-remove-dominated,
>     maf-join, maf2tab
> would get a -/--help option as well to be able to provide rudimentary
> manpages also for these tools.
> 
> IMHO this would be in the interest of your users - properly maintained
> manpages with real text would be even better.
> 
> Hope this helps a bit enhancing your fine software.
> 
> Kind regards and thanks for maintaining last
> 
>     Andreas.
> 
> [1] http://bugs.debian.org/138752
> 
> -- 
> http://fam-tille.de

> Author: Andreas Tille <tille@debian.org>
> Description: According to GNU coding standards help messages should go to stdout
>  not to stderr.  THis patch ensures that help2man will work correctly
> --- last-62.orig/src/LastalArguments.cc
> +++ last-62/src/LastalArguments.cc
> @@ -4,6 +4,8 @@
>  #include "stringify.hh"
>  #include <unistd.h>  // getopt
>  #include <sstream>
> +#include <cstdlib>
> +#include <iostream>
>  #include <vector>
>  #include <stdexcept>
>  #include <cstring>  // strtok
> @@ -108,7 +110,8 @@
>  	 != -1 ){
>      switch(c){
>      case 'h':
> -      throw std::runtime_error(help);
> +      std::cout << help ;
> +      exit(1);
>      case 'o':
>        outFile = optarg;
>        break;
> --- last-62.orig/src/LastdbArguments.cc
> +++ last-62/src/LastdbArguments.cc
> @@ -2,6 +2,8 @@
>  
>  #include "LastdbArguments.hh"
>  #include "stringify.hh"
> +#include <cstdlib>
> +#include <iostream>
>  #include <unistd.h>  // getopt
>  #include <stdexcept>
>  
> @@ -27,6 +29,7 @@
>  usage: lastdb [options] output-name fasta-sequence-file(s)\n\
>  \n\
>  Main Options (default settings):\n\
> +-h: show all options and their default settings\n\
>  -p: interpret the sequences as proteins\n\
>  -c: read the sequences case-sensitively\n\
>  -m: periodic spaced-seed pattern (" + maskPattern + ")\n\
> @@ -40,8 +43,11 @@
>  ";
>  
>    int c;
> -  while( (c = getopt(argc, argv, "pcm:w:s:a:b:v")) != -1 ) {
> +  while( (c = getopt(argc, argv, "hpcm:w:s:a:b:v")) != -1 ) {
>      switch(c){
> +    case 'h':
> +      std::cout << usage;
> +      exit(1);
>      case 'p':
>        isProtein = true;
>        break;


Reply to: