Skip to content
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

Options/Subcommand ordering in help text is backwards #26

Open
b-jazz opened this issue Feb 19, 2019 · 1 comment
Open

Options/Subcommand ordering in help text is backwards #26

b-jazz opened this issue Feb 19, 2019 · 1 comment

Comments

@b-jazz
Copy link

b-jazz commented Feb 19, 2019

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)
@worace
Copy link
Owner

worace commented Feb 19, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants