Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Upcoming (TBD)
==============

Features
---------
* Let `help <keyword>` list similar keywords when not found.


1.57.0 (2026/02/25)
==============

Expand Down
17 changes: 11 additions & 6 deletions mycli/packages/special/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,25 @@ def show_help(*_args) -> list[SQLResult]:

def show_keyword_help(cur: Cursor, arg: str) -> list[SQLResult]:
"""
Call the built-in "show <command>", to display help for an SQL keyword.
Call the built-in "show <keyword>", to display help for an SQL keyword.
:param cur: cursor
:param arg: string
:return: list
"""
keyword = arg.strip('"').strip("'")
query = f"help '{keyword}'"
keyword = arg.strip().strip('"\'')
query = 'help %s'
logger.debug(query)
cur.execute(query)
cur.execute(query, keyword)
if cur.description and cur.rowcount > 0:
headers = [x[0] for x in cur.description]
return [SQLResult(results=cur, headers=headers, status="")]
return [SQLResult(results=cur, headers=headers)]
logger.debug(query)
cur.execute(query, (f'%{keyword}%',))
if cur.description and cur.rowcount > 0:
headers = [x[0] for x in cur.description]
return [SQLResult(title='Similar terms:', results=cur, headers=headers)]
else:
return [SQLResult(status=f'No help found for {keyword}.')]
return [SQLResult(status=f'No help found for "{keyword}".')]


@special_command("exit", "exit", "Exit.", arg_type=ArgType.NO_QUERY, aliases=["\\q"])
Expand Down