Vapor CLI
A powerful command-line interface for SQLite database management with enhanced features for data manipulation, querying, testing, and integrated shell capabilities.
Installation
Basic Usage
Initialize a new database:
Connect to an existing database:
Create a new table:
List all tables:
Start an interactive REPL:
Start shell mode with database context:
Populate database with test data:
Features
REPL Mode
The interactive REPL provides a comprehensive SQL environment with these features:
SQL Operations:
- Execute any valid SQL statement ending with semicolon
- Transaction control with begin/commit/rollback
- Multi-line input support
Database Information:
- List all tables
- View table schemas
- Show database statistics
Output Control:
- Multiple output formats (table, JSON, CSV)
- Configurable row limits
- Query timing
- Export results to CSV
- Import data from CSV
Query Management:
- Save frequently used queries as bookmarks
- List and manage saved bookmarks
- Execute saved queries
Session Features:
- Command history
- Transaction status indicator
- Screen clearing
- Help system
Shell Mode
Integrated Unix shell with database context:
System Integration:
- Execute any system command (ls, grep, find, etc.)
- Built-in commands:
cd,pwd,history,help,exit - Tab completion for commands and file paths
- Dynamic prompt showing current working directory
Navigation:
- Full filesystem navigation with
cdcommand - Support for
~and~/path expansion - Real-time working directory display
History & Convenience:
- Command history stored in
~/.vapor_shell_history - Persistent across sessions
- Proper Ctrl+C handling
Library API
Use vapor-cli as a library in your Rust projects:
use VaporDB;
// Create or open a database
let mut db = create?;
// Execute SQL
db.execute?;
db.execute?;
// Use transactions
db.begin_transaction?;
db.execute?;
db.commit_transaction?;
// Export data
db.export_to_csv?;
// Manage bookmarks
if let Some = db.bookmark_manager
Data Import/Export
Import CSV data:
.import data.csv table_name
Export query results:
.export results.csv
Configuration
The tool automatically creates and manages:
- Command history in
.vapor_history - Bookmarks in
~/.vapor_bookmarks.json - Database files with
.dbextension
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