4 releases
0.0.5 | Jun 13, 2025 |
---|---|
0.0.4 | Jun 12, 2025 |
0.0.3 | Jun 10, 2025 |
0.0.2 | Jun 8, 2025 |
0.0.1 |
|
#694 in Database interfaces
612 downloads per month
175KB
3.5K
SLoC
Vapor CLI
Vapor CLI is a powerful, interactive command-line interface for SQLite databases. It's designed to be a lightweight, fast, and user-friendly tool for developers, data analysts, and anyone who works with SQLite. Vapor CLI combines the power of a direct SQL interface with the convenience of a modern shell and data management utilities.
Features
- Interactive SQL REPL: A robust Read-Eval-Print Loop for executing SQL queries, with multi-line input, command history, and auto-completion.
- Interactive Shell: A built-in shell for navigating the filesystem, running system commands, and managing your database environment without leaving the tool.
- Direct SQL Execution: Run SQL queries directly from your terminal for quick, one-off tasks.
- CSV Import/Export: Seamlessly import data from CSV files into tables or export query results to CSV.
- Database Population: Generate large volumes of synthetic data with configurable schemas, data types, and distributions for testing and development.
- Query Bookmarks: Save, manage, and reuse your frequently used SQL queries with a powerful bookmarking system.
- Multiple Output Formats: Display query results in different formats, including formatted tables, JSON, and CSV.
- Explicit Transaction Management: Manually control database transactions (
BEGIN
,COMMIT
,ROLLBACK
) within the REPL.
Installation
-
Clone the repository:
git clone https://github.com/ooyeku/vapor-cli.git cd vapor-cli
-
Build the project using Cargo:
cargo build --release
The executable will be located at
target/release/vapor-cli
. -
(Optional) Install it locally:
To make
vapor-cli
available from anywhere in your system, you can install it using Cargo:cargo install --path .
Usage
Initialize a Database
Create a new, empty SQLite database file.
vapor-cli init --name my_database.db
Connect to a Database
Check the connection to an existing database file.
vapor-cli connect --path my_database.db
Interactive SQL REPL
Start an interactive SQL Read-Eval-Print Loop to run queries against a database.
vapor-cli repl --db-path my_database.db
Inside the REPL, you can type SQL statements or use special dot-commands:
-- Select all users
SELECT * FROM users;
-- Special commands
.tables
.schema users
.exit
Interactive Shell
Start an interactive shell session with the database context loaded.
vapor-cli shell --db-path my_database.db
From the shell, you can run system commands or switch back to the REPL:
# List files
ls -l
# Switch back to the REPL
.vrepl
Manage Tables
Create a new table:
vapor-cli create-table --db-path my_database.db --name users --columns "id INTEGER PRIMARY KEY, name TEXT"
List all tables in the database:
vapor-cli list-tables --db-path my_database.db
Populate Database
Populate the database with a large amount of sample data for testing purposes.
vapor-cli populate --db-path my_database.db
Configuration
Vapor CLI stores its configuration and history in ~/.config/vapor/
.
Configuration
The tool automatically creates and manages:
- Command history in
.vapor_history
- Bookmarks in
~/.vapor_bookmarks.json
- Database files with
.db
extension
Error Handling
The tool provides detailed error messages and suggestions for common issues:
- Database access problems
- SQL syntax errors
- File system issues
- Resource constraints
Requirements
- Rust 1.70 or later
- SQLite 3
- Sufficient disk space for database operations
Dependencies
~32–43MB
~725K SLoC