Module repl

Module repl 

Source
Expand description

§Interactive REPL Mode

This module implements the interactive Read-Eval-Print Loop (REPL) for vapor-cli. It provides a command-line interface for users to execute SQL queries and special commands directly against a SQLite database.

§Features:

  • SQL Execution: Run any valid SQL query.
  • Special Commands: Dot-prefixed commands for database inspection, output formatting, etc. (e.g., .tables, .schema).
  • Multi-line Input: Supports SQL queries that span multiple lines, ending with a semicolon.
  • Command History: Persists command history between sessions.
  • Transaction Management: Supports BEGIN, COMMIT, and ROLLBACK with status indicators.
  • Query Bookmarking: Save, list, and run frequently used queries.
  • Non-Interactive Mode: Can execute SQL from piped input (e.g., cat query.sql | vapor-cli repl ...).
  • Robust Error Handling: Provides informative error messages and offers to reconnect on critical failures.

Functions§

repl_mode
Starts the interactive SQL REPL session.
show_help
Displays detailed help information for all REPL commands.