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

The help command does not work #674

Open
matheusmms031 opened this issue Jan 6, 2024 · 3 comments
Open

The help command does not work #674

matheusmms031 opened this issue Jan 6, 2024 · 3 comments
Labels
Bug Something isn't working Needs Triage Needs triage from the maintainer or core devs.

Comments

@matheusmms031
Copy link

matheusmms031 commented Jan 6, 2024

Bug report

Environment

  • Operating System: Windows 11 Home version 23H2
  • Python version: 3.12

Description of the bug

When I run the:

poetry run scanapi --help

command, nothing appears other than a response that would be given when typing poetry run scanapi.
image

Important

Maybe I'm executing the help command wrong because of poetry run, but that's what the page says
wiki, and this was already the subject of discussion in
another issue from 4 years ago #312.

Expected behavior ?

I don't know, I couldn't find the code for the --help parameter

How to reproduce the the bug ?

Do a git clone on the repository with:

git clone [email protected]:scanapi/scanapi.git

Enter the repository with cd path/scanapi and execute the following lines of code:

poetry install <- Install dependency
poetry update <- Make sure everything is installed and updated
poetry run scanapi --help <- Execute the command help

Anthing else we need to know?

Using -h also gives an error.

Captura de tela 2024-01-05 233914

@matheusmms031 matheusmms031 added Bug Something isn't working Needs Triage Needs triage from the maintainer or core devs. labels Jan 6, 2024
@withtwoemms
Copy link

In trying to repo this issue, I ran into #675. That issue presented a blocker for further investigation. Can now continue trying to reproduce.

@withtwoemms
Copy link

withtwoemms commented Jan 8, 2024

While I get the same results on macOS 11.7.10; python v3.12.0, the claim:

"nothing appears other than a response that would be given when typing poetry run scanapi."

seems a non-issue as the intended sub-command is never invoked. Running poetry run scanapi invokes the "scripts:main" console script which correctly displays that there is one subcommand available:

$ poetry run scanapi
Usage: scanapi [OPTIONS] COMMAND [ARGS]...

  Automated Testing and Documentation for your REST API.

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  run  Automated Testing and Documentation for your REST API.

Upon adding run to the poetry command, we gain access to the actual click command:

$ poetry run scanapi run -h
Usage: scanapi run [OPTIONS] [SPEC_PATH]

  Automated Testing and Documentation for your REST API. SPEC_PATH argument is
  the API specification file path.

Options:
  -o, --output-path PATH          Report output path.
  -nr, --no-report                Run ScanAPI without generating report.
  -b, --browser                   Open the results file using a browser
  -c, --config-path PATH          Configuration file path.
  -t, --template PATH             Custom report template path. The template
                                  must be a .jinja file.
  -ll, --log-level [DEBUG|INFO|WARNING|ERROR|CRITICAL]
                                  Set the debug logging level for the program.
  -h, --help                      Show this message and exit.

I suppose it's unfortunate that the poetry command has this idiosyncratic symmetry with run being featured twice, but it's fine.

Recommendation:

Documentation may improve the experience though I am not a fan of RTFM approaches. It would be prudent to leverage the no_args_is_help option to a `click command declaration which allow the following incantation to produce the appropriate help message:

poetry run scanapi run

But even this requires run be featured a second time.

@matheusmms031
Copy link
Author

matheusmms031 commented Jan 9, 2024

Actually, I read your analysis and you are 100% correct, scanapi run and poetry run scanapi call the same main, but it's funny that we have to use another run to execute the help command.

However, as you said, I think it is more efficient for them to use the help that comes with the click library.

Maybe later I will fork the repository and fix this error and make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Needs Triage Needs triage from the maintainer or core devs.
Projects
None yet
Development

No branches or pull requests

2 participants