Skip to content

Let "help <term>" fall back to list similar terms#1631

Open
rolandwalker wants to merge 1 commit intomainfrom
RW/help-keyword-fallback
Open

Let "help <term>" fall back to list similar terms#1631
rolandwalker wants to merge 1 commit intomainfrom
RW/help-keyword-fallback

Conversation

@rolandwalker
Copy link
Contributor

@rolandwalker rolandwalker commented Feb 25, 2026

Description

Let "help " fall back to list similar terms when the term is not found.

  • parameterize the help query
  • no need to pass empty status property
  • search for %keyword% if exact search fails, and report those results as a table of similar terms
  • quote "keyword" in failure message

Example:

last image

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 Feb 25, 2026
@github-actions
Copy link

Findings

  • cur.execute(query, keyword) and cur.execute(query, f'%{keyword}%') pass a bare string as params. Many DB-API drivers treat a string as an iterable and won’t bind as a single parameter, which can raise or mis-bind depending on the driver. Use single-item tuples instead. mycli/packages/special/main.py:181 and mycli/packages/special/main.py:186.

Missing tests / edge cases

  • Add tests for help <term> fallback behavior: when exact match fails it should return a “Similar terms” table. Also cover quoted/empty keywords (help "") to ensure you don’t accidentally match everything via %%. mycli/packages/special/main.py:178-191.

If you want, I can propose a small patch for the parameter binding and a minimal test.

when the term is not found.

 * parameterize the help query
 * no need to pass empty status property
 * search for %keyword% if exact search fails, and report those results
   as a table of similar terms
 * quote "keyword" in failure message
@rolandwalker rolandwalker force-pushed the RW/help-keyword-fallback branch from e925a6d to 0ea5acd Compare February 26, 2026 10:51
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