-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to document long-form options, modifiers, and directives for GMT? #5561
Comments
I like the example given in devdocs
I would explicit the units used for good measure. Back on track, I would recommend to only use the long-format in the documentation, and have a separate table for "short option" (similar to common options page). For more "seasoned" users. For the other issue, most of the command-line manual give both syntaxes with comma-seperation ( |
I agree with this. I expect listing both short and long options would make the documentation more confusing and a table showing short versus long options would be a good compromise.
This works for the options, but what about the modifiers and directives? I do not know of other command-line programs that have as complicated of modifiers as GMT, which would make this a lot to maintain relative to the gawk command-line manual. |
Is it possible to have line break in cmd manual ? |
Yes, this is possible. We could try it and see how it looks. |
@meghanrjones and I discussed the possibility of auto-generating some RST documentation from the C structure to avoid repetition of material (which will easily get out of sync otherwise) and to make the documentation update manageable. There are a few challenges that I did not immediately recognize. For instance, the structure might have this:
and from this I would like to generate the two strings: -Baxes[+b][+ffill][+n][+olon/lat][+ttitle][+ssubtitle] I will not be able to do this since there is no information in the structure to tell me if a modifier takes a) a required argument, b) an optional argument, or c) no argument. That information would need to be added to the structure, which can also aid in the parsing and finding parsing errors (missing required modifier argument, argument given to modifier that does not take one, etc.). Furthermore, I would not be able to use sensible names other than [args] or args since suitable names for the arguments is not part of the definition above. So, for the benefit of documentation I may need to expand that structure to have more metadata that allows for better parsing and automatic RST generation. |
After updating for missing modifiers in the frame listing (+i,+w,+x,+y,+z) [i.e., #5592], it looks like this:
To have the required information I think it may need to be this:
With this I will know which modifiers take required (e.g., +fill), optional (e.g., +pen), or no argument (e.g., +box), and what words are recommended to use for those dummy arguments in the docs. |
To be clear, the proposed change above would internally be handled in two different ways:
Let me know if you see any concerns about this enhancement, @meghanrjones as I am eager to take the deep dive. |
Yes, seems good to me. Only complications I could see are for the options that use |
Good point, maybe I will look for another character than = to mean = and that we don't use. Like *. |
Looks like the same applies to directives. Currently, the gmt_common_longoptions.h structure does not yet list a directive for -B[axes][+b][+gfill][+n][+ttitle] is equivalent to --frame[=axes][+box][+fill=fill][+noframe][+title=text] PS. Looking at +fill. I don't like it. +fill could be a value going into a grid if not filled, for instance. isn't +paint=fill better? |
Just one quick comment. The long-form options definitely will make GMT scripts more readable and also will make GMT wrappers easier to maintain, but these long names will also make it difficult to write GMT scripts. Python and Julia like long names because most text editors support auto-completion for these languages, while it seems technically difficult to let any editor autocomplete GMT's long-form options, modifiers and directives. |
Yes, undoubtedly true. While many editors can accept plugins to learn about more languages, I am not sure if we will be in the business of building such plugins, but there may be some users who could do this. I think the argument that it makes the script more readable is still a strong enough argument that we will continue on that path. However, I still see more cleaning up to do with the way we present the short options. Take -bi for instance:
The online docs explains more (say what w, +l|b means). However, in a long-option framework the plan was to use
In reality,
|
I think I need to go through these common options and see if I can better document them in a way that says the same things but uses better explanations, like what I suggest for -bi. |
It's not going to be a clear gain. GMT convertees will see it as a useless thing but my experience in the Julia forum is: |
Julia uses |
So bg and bgcolor are out as the first is unclear and the second says it must be a color (but we may want a pattern). background is not bad though. |
* Improve usage and docs for -b See discussion in #5561. * More updates * Alphabetical... * Update gmt_synopsis.h
Description of the issue
Paul outlined the proposed implementation of GMT long-form options, modifiers, and directives in the developer documentation (see also project 1). This issue is to decide the documentation structure for long-form options, modifiers, and directives.
Comparison with wrappers
The GMT.jl documentation uses bars to separate the short option and its aliases and then uses links for the options that have long-formats for the modifiers/directives (e.g., https://www.generic-mapping-tools.org/GMT.jl/dev/arrows_control/#Vector-Attributes).
The PyGMT documentation includes a table for short-form/long-form options at the start of each modules' documentation and currently does not implement long-format for modifiers/directives.
Options for documenting long-options:
Here are a few options (suggestions are welcome):
Other issues:
Will the long-options be documented both in the ReST documentation and the command line usage messages or only the ReST documentation? My vote is to only document in one place.
The text was updated successfully, but these errors were encountered: