vapor-cli

Crates.iovapor-cli
lib.rsvapor-cli
version0.0.5
created_at2025-06-07 23:39:45.265324+00
updated_at2025-06-13 01:06:49.880197+00
descriptionA command-line interface for SQLite database management with enhanced features for data manipulation, querying, and testing
homepage
repositoryhttps://github.com/ooyeku/vapor-cli
max_upload_size
id1704497
size206,583
ola yeku (ooyeku)

documentation

README

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

  1. Clone the repository:

    git clone https://github.com/ooyeku/vapor-cli.git
    cd vapor-cli
    
  2. Build the project using Cargo:

    cargo build --release
    

    The executable will be located at target/release/vapor-cli.

  3. (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
Commit count: 29

cargo fmt