GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
848 stars 354 forks source link

gmt docs cannot position at a specified option #1531

Closed seisman closed 5 years ago

seisman commented 5 years ago

The output with -Q is correct:

$ gmt docs -Q coast -R
file:////Users/seisman/local/GMT/share/doc/html/coast.html#r

but gmt docs coast -R opens file:///Users/seisman/local/GMT/share/doc/html/coast.html without the trailing #r.

PaulWessel commented 5 years ago

Are you sure? I just built the latest and it worked fine for me.

seisman commented 5 years ago

Did you open the local documentation or the remote one? If I remove my local documentation, gmt docs coast -R opens https://docs.generic-mapping-tools.org/dev/coast.html#r for me, which is correct.

PaulWessel commented 5 years ago

Sorry, it was the remote one. Going to beach, will look later.

joa-quim commented 5 years ago

On Win the local docs drop the #?. That is

cmd /c start file:///C:/progs_cygw/GMTdev/gmt5/compileds/gmt6/VC14_64/share/doc/html/psxy.html#r

drops the #r in the browser. Go figure why.

joa-quim commented 5 years ago

And how come that -Q works for you? It can't (and it doesn't). See sc of a debug session. print_url remains false so it can't print the address.

Capture

joa-quim commented 5 years ago

Besides, 3 lines bellow it tests (GMT_OPT_INFILE = '<')

if (opt->option != GMT_OPT_INFILE) {    /* This is not good */

EDIT: Sorry, before there was a opt = opt->next. So it's like it expects opt->option = 'Q' to be in the linked list before opt->option = '>', but at least on Win it isn't.

joa-quim commented 5 years ago

And I finally saw my error

C:\v>gmt docs -Q plot
file:///C:/progs_cygw/GMTdev/gmt5/compileds/gmt6/VC14_64/share/doc/html/plot.html

this is not a good syntax. Why do we force it and lead dumb users do this mistake?

PaulWessel commented 5 years ago

We require the -Q to be the first argument after program name docs otherwise it would get confused with -Q options in the modules.

PaulWessel commented 5 years ago

Still not sure what you guys see:

pwessel@MacBeth:> gmt docs -Q coast -R
file:////Users/pwessel/UH/RESEARCH/CVSPROJECTS/GMTdev/gmt-dev/dbuild/gmt6/share/doc/html/coast.html#r
pwessel@MacBeth:> gmt docs -Q -S coast -R
https://docs.generic-mapping-tools.org/dev/coast.html#r
joa-quim commented 5 years ago

I also see that, but like I said above when sent to the browser the #r is dropped.

joa-quim commented 5 years ago

Still regarding the order, why not?

if (opt->option == 'Q' ||  (opt->next && opt->next->option == 'Q'))
PaulWessel commented 5 years ago

Well, we do opt = top->next and go back up so why check the next one when we do it in the loop?

joa-quim commented 5 years ago

Because the first time the loop runs, if it doesn't find -Q, it opens the browser right away. My idea would allow docs plot -Q -R and docs -Q plot -R but not docs plot -R -Q.

PaulWessel commented 5 years ago

Slippery slope to pass -Q to the module plot. So you would do gmt docs grdimage -Q -Q or just one -Q etc? What problem are we trying to solve here? People mixing up options and passing -Q to the module? Is this really a problem for us or the user?

joa-quim commented 5 years ago

Ok, had forgotten about program's -Q option (which do not work anyway). Going dinner.

PaulWessel commented 5 years ago

You guys still have trouble? For me

pwessel@MacBeth:> gmt docs coast -R pwessel@MacBeth:> gmt docs -S coast -R

opens up coast at the -R description.

seisman commented 5 years ago

gmt docs -S coast -R works, but gmt docs coast -R still not.

seisman commented 5 years ago

gmt docs -Vd coast -R says:

docs [DEBUG]: Opening file:////Users/seisman/local/GMT/share/doc/html/coast.html#r via open

but the URL showed in the opened browser is

file:///Users/seisman/local/GMT/share/doc/html/coast.html
joa-quim commented 5 years ago

It's not GMT. This doesn't work


cmd /c start file:///C:/progs_cygw/GMTdev/gmt5/compileds/gmt6/VC14_64/share/doc/html/psxy.html#r
``
PaulWessel commented 5 years ago

Yes sorry, you are right. But

gmt docs -Vd coast -R ... docs [DEBUG]: Opening file:////Users/pwessel/UH/RESEARCH/CVSPROJECTS/GMTdev/gmt-dev/dbuild/gmt6/share/doc/html/coast.html#r via open

so what is happening to the #r in that URL? It is in the URL . OK @joa-quim says the same.

seisman commented 5 years ago

Yes, you're right.

open file:///Users/seisman/local/GMT/share/doc/html/coast.html#r

also doesn't work.

seisman commented 5 years ago

FYI, https://en.wikipedia.org/wiki/File_URI_scheme

PaulWessel commented 5 years ago

OK, I think the # marks a comment for the shell and it is skipped. Replacing # with %23 gives

pwessel@MacBeth:~/UH/RESEARCH/CVSPROJECTS/GMTdev/gmt-dev/dbuild/gmt6/share/doc/html-> open file:////Users/pwessel/UH/RESEARCH/CVSPROJECTS/GMTdev/gmt-dev/dbuild/gmt6/share/doc/html/coast.html%23r The file //Users/pwessel/UH/RESEARCH/CVSPROJECTS/GMTdev/gmt-dev/dbuild/gmt6/share/doc/html/coast.html#r does not exist.

So a @seisman link points out, not supported.

PaulWessel commented 5 years ago

So some choices here:

Since adding an option to a module only works for a true URL link, do we make server the default and replace -S with -L for local? If not, do we issue a warning when users supply an option without also using -S?

seisman commented 5 years ago

Since adding an option to a module only works for a true URL link, do we make server the default and replace -S with -L for local?

I prefer to keep the local one as the default, as it's much faster.

If not, do we issue a warning when users supply an option without also using -S?

agree.

joa-quim commented 5 years ago

I also prefer the local but we can have a mixed solution. if (-R) goWeb

PaulWessel commented 5 years ago

Hm, yes I think that is a better solution. If you want to use local you don't give those options, else we force going to the server. OK with your @seisman ?

seisman commented 5 years ago

OK to me.

PaulWessel commented 5 years ago

Closed as fixed.