worace/geoq

Options/Subcommand ordering in help text is backwards

Opened this issue · 1 comments

Example where the commands are specified in the order according to the help text:

[b-jazz:~] 1 $ geoq gh roots | geoq  filter --query-file ~/osm/osmi2/forty-seven-states-boundary.geojson intersects                     
Must provide Query Features as either --file or positional argument.
Application error: MissingArgument

Example with the "correct" order:

[b-jazz:~] 1 $ geoq gh roots | geoq  filter  intersects --query-file ~/osm/osmi2/forty-seven-states-boundary.geojson                    
9
c
d
f

Help text:

[b-jazz:~] $ geoq gh roots | geoq  filter help
geoq-filter
Select features based on geospatial predicates               

USAGE:
    geoq filter [OPTIONS] [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -q, --query-file <query-file>    Input file for reading query feature(s).

SUBCOMMANDS:
    contains      Output only entities (from STDIN) which fall within a QUERY entity (as command-line ARG)
    help          Prints this message or the help of the given subcommand(s)
    intersects    Output only entities (from STDIN) which intersect a QUERY entity (as command-line ARG)

Oh yeah, I had a little trouble around this when I was implementing it. Since the flag is the same for both the intersects and contains subcommands I wanted to avoid having to repeat the code for it in both places. So the solution I found was to mark it as "global" and put it under the filter command instead. But I see now that this has the confusing effect you are describing. I'll poke around more in the Clap docs and see if there is a cleaner way around this.