Skip to content

Improve .help in the sqlite3 CLI #133934

Closed
Closed

Description

@tanloong

Feature or enhancement

Proposal:

The .help command in the sqlite3 CLI does not give much information. It only shows a brief message:

sqlite> .help
Enter SQL code and press enter.

It would be better if .help displayed a list of available commands, and .help <command> showed detailed help for that specific command.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on May 15, 2025
  2. StanFromIreland commented on Jun 6, 2025

    @StanFromIreland
    Member

    We only need help for two commands, how about we hard-code it? I wrote a patch which can be seen below.

    Subject: [PATCH] Expand help
    ---
    Index: Lib/sqlite3/__main__.py
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    diff --git a/Lib/sqlite3/__main__.py b/Lib/sqlite3/__main__.py
    --- a/Lib/sqlite3/__main__.py	(revision 0df15d0d4d55dcf7b7a7f4b2985bf84fd092d257)
    +++ b/Lib/sqlite3/__main__.py	(date 1749219376897)
    @@ -63,7 +63,10 @@
                     case "version":
                         print(f"{sqlite3.sqlite_version}")
                     case "help":
    -                    print("Enter SQL code and press enter.")
    +                    t = theme.syntax
    +                    print(f"Enter SQL code or one of the below commands, and press enter.\n"
    +                          f"{t.builtin}.version{t.reset}    Print the SQLite version\n"
    +                          f"{t.builtin}.quit{t.reset}       Exit the CLI, equivalent to CTRL-D\n")
                     case "quit":
                         sys.exit(0)
                     case "":

    What do you think @erlend-aasland of this approach?

  3. erlend-aasland commented on Jun 6, 2025

    @erlend-aasland
    Contributor

    SGTM, Stan.

  4. added a commit that references this issue on Jun 19, 2025
  5. added a commit that references this issue on Jun 19, 2025
  6. added a commit that references this issue on Jul 12, 2025
  7. added a commit that references this issue on Aug 4, 2025
  8. added a commit that references this issue on Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-sqlite3type-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions