Skip to content

Return helpdoc for single -h#1733

Open
rolandwalker wants to merge 1 commit intomainfrom
RW/treat-dash-h-as-help
Open

Return helpdoc for single -h#1733
rolandwalker wants to merge 1 commit intomainfrom
RW/treat-dash-h-as-help

Conversation

@rolandwalker
Copy link
Contributor

Description

-h alone cannot be a hostname specification, so when it is the only item in the list of arguments, respond with the helpdoc, matching the behavior of --help.

Previously, if the user ran

mycli -h

the response was only the cryptic

Error: Option '-h' requires an argument.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker self-assigned this Mar 21, 2026
@github-actions
Copy link

  1. Low: Missing end-to-end test for actual CLI behavior of mycli -h
    • Current tests only validate the helper function output (filtered_sys_argv) in test/test_main.py:156 and test/test_main.py:164.
    • They do not verify that invoking main() with sys.argv=['mycli','-h'] actually returns help text and exits successfully (the user-visible behavior this PR changes at mycli/main.py:2716).
    • Action: add an integration-style test that asserts -h and --help have equivalent outcome (exit code and help output), and that -h example.com still maps to host.

No correctness or security issues stood out in the code change itself.

Could not run tests in this environment because pytest is not installed (pytest: command not found).

"-h" alone cannot be a hostname specification, so when it is the only
item in the list of arguments, respond with the helpdoc, matching the
behavior of "--help".

Previously, if the user ran

    mycli -h

the response was only the cryptic

    Error: Option '-h' requires an argument.
@rolandwalker rolandwalker force-pushed the RW/treat-dash-h-as-help branch from f37d9b6 to cd420f6 Compare March 21, 2026 19:55
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

Successfully merging this pull request may close these issues.

1 participant