genometools icon indicating copy to clipboard operation
genometools copied to clipboard

gt -help more verbose

Open Garonenur opened this issue 11 years ago • 9 comments

print out one liners on gt -help output

Garonenur avatar May 27 '14 18:05 Garonenur

Can you be more specific? How exactly should that look like?

gordon avatar May 27 '14 23:05 gordon

@satta and I though about printing the one liner from the help of each tool next to it in the tool lists.

Then, if searching for a tool, there is a little more information then only the name. Which, for example seq is not really enough to deduct the function of a tool.

Garonenur avatar May 28 '14 06:05 Garonenur

This was an idea that came up seeing that gt -help currently throws 71 tool names at you, which makes it difficult for a new user to find out which tool to use for a given task.

satta avatar May 28 '14 08:05 satta

We tried to make the -help outputs no more than 80 wide (most one liners should conform to that). If we print them after the tool names the gt -help output will wrap on 80 character wide terminals and look ugly. What happened to issue #162? That would make the list of tools look less overwhelming.

gordon avatar May 28 '14 12:05 gordon

the conclusion of #162 was not to do it, because it is like an API for scripts and would break to many of them? I would still like shorter lists and move some tools into boxes, but maybe print the one-liner, too. It would have to be wrapped, so the formatting looks nice though.

Garonenur avatar May 28 '14 13:05 Garonenur

One could adapt the output length to fit the terminal width (IIRC code to determine that is in the progress bar module?) so text does not get wrapped.

satta avatar May 28 '14 14:05 satta

I feel the fate of this issue is independent of #162. I think it makes sense to show one line description of tools even if we have only 9 top-level tools to show (9 is as per - https://github.com/genometools/genometools/wiki/Toolboxes), and that #162 and this can be done in any order.

I would like to send a PR for this issue. But after spending a couple of minutes on the code, I still don't have any idea where does the listing of tools in gt -help come from. :(

yeban avatar Sep 13 '14 19:09 yeban

The listing comes from show_gtr_help() in gtr.c which simply lists all tools in the top-level toolbox. The idea is that there are comment functions, which can run arbitrary code after outputting the options registered in an option parser, and it is commonly used to put more descriptive text there. They are attached to an option parser using gt_option_parser_set_comment_func() e.g. see line 167 in gtr.c. That is, to modify the output there one would have to modify gt_toolbox_show() (line 154). I hope that helps a bit. If there are more questions just ask. For this task I think it would also be good to take a look at the GtTool, GtToolbox and GtOptionParser API headers (*_api.h) to learn how to query them for the required information.

satta avatar Sep 13 '14 21:09 satta

Thanks @satta. That sure helps. I will try to work this out this weekend or by the next weekend.

yeban avatar Sep 15 '14 14:09 yeban