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

Help suggests order of arguments that halp does not accept. #30

Closed
cafce25 opened this issue Apr 21, 2023 · 8 comments
Closed

Help suggests order of arguments that halp does not accept. #30

cafce25 opened this issue Apr 21, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@cafce25
Copy link

cafce25 commented Apr 21, 2023

Describe the bug

When run with --help or without a CMD the help suggests the syntax halp [OPTIONS] [CMD] <COMMAND>.
But running halp anycmd plz which follows that order errors with

error: the following required arguments were not provided:
  <CMD>

Usage: halp plz <CMD>

For more information, try '--help'.

To reproduce

halp anycmd plz

Expected behavior

Either the help should not list the arguments in the wrong order (I think that's the proper solution) or it should accept the suggested syntax.

Software information

  • Project version: halp 0.1.5

And likely irrelevant but here you go:

  • Operating system: Arch GNU/Linux x86_64 6.2.10-arch1-1
  • Rust version: rustc 1.69.0 (84c898d65 2023-04-16)
@cafce25 cafce25 added the bug Something isn't working label Apr 21, 2023
@artogahr
Copy link

artogahr commented Apr 25, 2023

I think you're confusing [CMD] with <COMMAND> here.

[CMD] is the optional (hence the `[]') subcommand, which right now only accepts "plz".

<COMMAND> is the non-optional program name you want to get help for.

So your query halp anycmd plz is in halp <COMMAND> [CMD] order, which is incorrect.

@cafce25
Copy link
Author

cafce25 commented Apr 25, 2023

In that case I think the other guidance is off/inconsistent because in the line above halp [OPTIONS] <CMD> is suggested and

Arguments:
   <CMD> Command or binary name

is the only explanation of CMD anywhere.

also plz is in the Commands section further enforcing the suggestion <COMMAND> would be plz and [CMD] the "Command or binary name"

full output for context:

A CLI tool to get help with CLI tools 🐙

Usage: halp [OPTIONS] <CMD>
       halp [OPTIONS] [CMD] <COMMAND>

Commands:
  plz  Get additional help

Arguments:
  <CMD>  Command or binary name

Options:
      --check <ARG>    Sets the argument to check
      --no-version     Disable checking the version information
      --no-help        Disable checking the help information
  -c, --config <PATH>  Sets the configuration file [env: HALP_CONFIG=]
  -v, --verbose        Enables verbose logging
  -h, --help           Print help
  -V, --version        Print version

@artogahr
Copy link

artogahr commented Apr 26, 2023

I get the confusion. I just checked and in man halp the ordering also looks incorrect:

SYNOPSIS halp [--check] [--no-version] [--no-help] [-c|--config] [-v|--verbose] [-h|--help] [-V|--version] <CMD> [subcommands]

Maybe moving to a "subcommand" name everywhere would clear things up @orhun ?

Side note:

full output for context:

I couldn't find out where you got this output from

@cafce25
Copy link
Author

cafce25 commented Apr 26, 2023

I couldn't find out where you got this output from

That's just the output of halp --help or the help section of halp halp

@artogahr
Copy link

I know, I worded that very wrongly haha. What I meant is I can't figure out where in the codebase this output is programmed. I assume it's being auto-generated somewhere seeing I can't find it with grep, but so far I haven't been able to figure it out.

@cafce25
Copy link
Author

cafce25 commented Apr 26, 2023

Ah I see, looks to me like the typical clap generated help so probably in src/cli.rs in the #[derive(Parser)] macro.

@orhun
Copy link
Owner

orhun commented Apr 30, 2023

I see the issue here. That help/usage text should be somehow "overridable" via clap options I think. Needs a bit of digging.

@orhun
Copy link
Owner

orhun commented Jun 17, 2023

Updated the help text in f849305

@orhun orhun closed this as completed Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants