Skip to content

Repository files navigation

SimpleCLI: Headless Console & RAD Toolkit for V

Language License Zero Dependencies Platform

SimpleCLI is a comprehensive, lightweight, zero-window console utility framework and Rapid Application Development (RAD) toolkit for the V programming language.

It brings cross-platform OS system calls, hardware resource monitoring, desktop notifications, speech synthesis, standard path resolvers, cryptography, HTTP, generic data structures, string similarity metrics, multi-level logging, CLI flag parsing, interactive prompts, and stdlib wrappers directly to command-line utilities and automation scripts without requiring any graphical window backend (no gg/sokol GUI dependencies).


📑 Table of Contents


🎬 Live Demos & Terminal Recordings

🧮 Mathematics & Scientific Computing Suite

SimpleCLI Mathematics Suite

📼 Replay Math Session: asciinema play assets/math_suite.cast

📺 Individual Mathematical & Developer Tool Recordings (Click to Expand)
Application Themed VHS Preview Asciinema Replay
Programmer Calculator
Base Radix & Bitwise Engine
Calc Demo asciinema play assets/calc_demo.cast
Statistics Studio
Central Tendency, RMS & StdDev
Stats Demo asciinema play assets/stats_demo.cast
Kalker Scientific Math
Trigonometry, Calculus & Constants
Kalker Demo asciinema play assets/kalker_demo.cast
Numbat Physical Units
Dimensional Physics Analysis
Numbat Demo asciinema play assets/numbat_demo.cast
ASCII Graph Visualizer
Terminal Bar & Percentile Charts
Graph Demo asciinema play assets/graph_demo.cast
Crypto Studio
SHA-256 & AES-256 Encryption
Crypto Demo asciinema play assets/crypto_demo.cast
Data Format Converter
CSV Tabular to JSON Parser
DataConvert Demo asciinema play assets/dataconvert_demo.cast

📼 Recording Your Own Demos with SimpleCLI Studio

Record your own apps using the built-in Terminal Recorder Studio:

# Launch interactive recording wizard
v run cli_apps/terminal_recorder_studio.v --interactive

# Batch record any math or CLI command to a themed GIF via VHS
v run cli_apps/terminal_recorder_studio.v --cmd "./bin/kalker_cli -e 'sin(pi / 4) * sqrt(144)'" --out assets/math.gif --theme "TokyoNight"

# Render all predefined VHS tape scripts:
for tape in scripts/tapes/*.tape; do vhs "$tape"; done

✨ Features

  • 🚀 Zero GUI Dependencies: Pure terminal, zero Cocoa/Sokol/X11 window overhead. Fast startup and minimal binary footprint.
  • 🎨 Rich RAD Console UI: Framed panels, Unicode data tables, ASCII banners, status badges, GitHub-style alert boxes, sparklines, meter gauges, hierarchical trees, and colored line diffs.
  • 🎛️ Interactive Terminal Prompts: Single/multi-select menus, fuzzy autocomplete search, masked password prompts, email/URL validators, and multi-field console form wizards.
  • Multi-Step Pipelines: Chained workflow execution with step spinners, precise timers, and summary reporting.
  • 🪵 Structured Multi-Level Logging: Trace, Debug, Info, Warn, Error, and Fatal logging with automatic timestamps and optional file streaming.
  • 📊 Hardware & Telemetry: CPU load averages, RAM allocation, disk capacity, Wi-Fi SSID, network IP addresses, and TCP port scanner.
  • 🔒 Security & Cryptography: SHA-256/512/MD5, AES-256-CBC encryption/decryption, HMAC, BCrypt password hashing, and UUID generation.
  • 🌐 HTTP & Networking: REST API client with status codes, headers, and file downloads.
  • 📦 Generic Data Structures: Stack, Queue, Set, RingBuffer, and MinHeap.
  • 🧮 Statistics & Math: Mean, median, standard deviation, RMS, variance, and numeric aggregations.
  • 🛠️ 49 Pre-Built Production CLI Tools: Ready-to-run utilities for DevOps, security, databases, text processing, media, and mathematics.

📦 Installation & Setup

Install via V Modules

Clone or symlink vlang_simplecli into your ~/.vmodules directory:

git clone https://github.com/codecaine-zz/vlang_simplecli.git ~/.vmodules/simplecli

Now you can import simplecli anywhere in your V projects:

import simplecli

🚀 Quick Start

module main

import simplecli

fn main() {
	mut app := simplecli.new_app('DeployPilot', '1.0.0')
		.set_description('Cloud Infrastructure Deployment Automation')

	// Define CLI Flags
	app.add_flag_string('env', 'e', 'staging', 'Target deployment environment (staging|prod)')
	app.add_flag_int('port', 'p', 8080, 'Listening port number')
	app.add_flag_bool('dry-run', 'd', false, 'Simulate deployment without modifying resources')

	app.parse_cli() or { return }

	target_env := app.get_flag_string('env')
	is_dry_run := app.get_flag_bool('dry-run')

	app.banner('DeployPilot Cloud Runner', 'Target: ${target_env}')

	app.step(1, 'Validating Credentials')
	app.success('Authentication tokens verified')

	app.step(2, 'Running Infrastructure Pipeline')
	mut pipeline := app.new_pipeline('Deployment Stages')
	pipeline.add_step('Provision compute instances', fn () bool { return true })
	pipeline.add_step('Apply database migrations', fn () bool { return true })
	pipeline.add_step('Configure load balancer routes', fn () bool { return true })
	pipeline.run()

	app.panel('Status Summary', 'All deployment stages completed successfully on ${target_env}.')
}

🖥️ Console UI & RAD Components

Terminal ANSI Styling

app.println(app.bold('Bold headline text'))
app.println(app.dim('Muted debug commentary'))
app.println(app.green('✓ All 48 tests passed successfully'))
app.println(app.cyan('ℹ Connecting to database cluster...'))
app.println(app.yellow('⚠ High disk usage detected'))
app.println(app.red('✖ Fatal connection drop'))
app.println(app.blue('⚡ Initializing thread pool'))
app.println(app.magenta('◆ Deployment tag v2.4.0'))

Steps, Dividers, Banners & Panels

// Step indicator with number and title
app.step(1, 'Compiling Native Binaries')

// Horizontal dividers
app.divider('─', 60)

// Header banner with title and subtitle
app.banner('Sentinel Infrastructure Pilot', 'Production Node 04 - us-east-1')

// Framed panel with bordered title
app.panel('Cluster Health', 'All 12 nodes reporting healthy heartbeat (RTT < 4ms).')

Key-Value Pairs & Formatted Tables

// Output aligned key-value status dictionary
app.print_kv({
	'Host Name': 'srv-prod-api-01',
	'IP Address': '10.0.4.18',
	'Architecture': 'aarch64 (Apple Silicon)',
	'Uptime': '14 days, 6 hours',
})

// Output formatted data grid with aligned column widths and borders
app.table(
	['Endpoint', 'Protocol', 'Latency', 'Status'],
	[
		['https://api.internal/v1', 'HTTP/2', '12.4 ms', '200 OK'],
		['https://auth.internal', 'HTTP/2', '8.1 ms', '200 OK'],
		['postgres://10.0.0.5:5432', 'TCP', '1.2 ms', 'CONNECTED'],
		['redis://10.0.0.9:6379', 'TCP', '0.4 ms', 'CONNECTED'],
	]
)

Progress Bars & Animated Spinners

// Dynamic progress bar in loops
for i in 1 .. 101 {
	app.progress_bar(f64(i), 100.0, 'Migrating database tables')
	time.sleep(20 * time.millisecond)
}

// Synchronous animated spinner
app.spinner('Synchronizing repository submodules...', 1500)

Unicode Sparklines & Bar Charts

latencies := [12.0, 15.0, 45.0, 90.0, 120.0, 80.0, 30.0, 14.0]
spark := app.sparkline(latencies)
app.info('Latency Trend (last 8 ticks): ${spark}')
// Output: Latency Trend (last 8 ticks):  ▂▄▆█▆▂ 

app.bar_chart('Resource Allocation (%)', {
	'CPU Core 0': 42.5
	'CPU Core 1': 89.0
	'Memory':     64.2
	'Disk /':     23.8
}, 30)

Meter Gauges & Threshold Badges

app.gauge('PostgreSQL Connection Pool', 48.0, 50.0, 'conns')
// Output: PostgreSQL Connection Pool: [████████████████████░░] 48.0/50.0 conns (96.0%) [CRITICAL]

Hierarchical Tree Visualizer

mut root := simplecli.new_tree_node('production-cluster')
mut db := root.add_child('postgres-db')
db.add_child('replica-01 (read-only)')
db.add_child('replica-02 (standby)')
root.add_child('redis-cache')
mut api := root.add_child('api-gateway')
api.add_child('auth-service')
api.add_child('payment-service')

app.tree(root)

Colorized Line Diff Viewer

old_config := 'port: 8080\nworkers: 4\nenv: staging'
new_config := 'port: 8080\nworkers: 8\nenv: production\ntls: true'

app.diff(old_config, new_config)

Interactive Prompts, Selects & Forms

// Text and masked password prompts
username := app.prompt('Enter username: ', 'admin')
password := app.prompt_password('Enter secret key: ')

// Single and Multi-Select menus
choice := app.select('Choose build target environment:', [
	'Local Development',
	'Staging Integration',
	'Production Release',
])

// Fuzzy interactive selector
branch := app.fuzzy_select('Search and checkout Git branch:', [
	'main',
	'feature/rad-components',
	'feature/graphql-api',
	'bugfix/state-persistence',
])

// Framed console form / wizard
form_data := app.form('Deploy Microservice Wizard', [
	simplecli.FormField{ key: 'name', label: 'Service Name', kind: .text, required: true },
	simplecli.FormField{ key: 'port', label: 'Listen Port', kind: .number, default_val: '8080' },
	simplecli.FormField{ key: 'secret', label: 'Master API Key', kind: .password, required: true },
])

Multi-Step Task Pipeline Runner

mut pipeline := app.new_pipeline('Production Release Pipeline')
pipeline.add_step('Clean temporary build artifacts', fn () bool {
	return os.rmdir_all('/tmp/build') or { true }
})
pipeline.add_step('Compile native binaries', fn () bool {
	time.sleep(200 * time.millisecond)
	return true
})
pipeline.run()

🛠️ Complete Suite of 49 CLI Applications

The cli_apps/ folder contains 49 production-grade command-line tools ready to run:

Category Application Command
DevOps & Infra DevOps Sentinel v run cli_apps/devops_sentinel.v --interactive
Vault Backup Manager v run cli_apps/vault_backup_manager.v -h
API Stress Bench v run cli_apps/api_stress_bench.v --url https://httpbin.org/get
Git Workspace Pilot v run cli_apps/multirepo_git_pilot.v --path .
Docker Studio CLI v run cli_apps/docker_cli.v --interactive
Homebrew Studio CLI v run cli_apps/brew_cli.v --interactive
Launchd & Cron CLI v run cli_apps/launchd_cli.v --interactive
Task Manager CLI v run cli_apps/task_manager_cli.v --interactive
Disk Space CLI v run cli_apps/disk_cli.v --interactive
App Bundler CLI v run cli_apps/app_bundler_cli.v --interactive
Terminal Recorder Studio v run cli_apps/terminal_recorder_studio.v --interactive
Security & Network API Studio CLI v run cli_apps/api_studio_cli.v --interactive
Nmap Port Scanner CLI v run cli_apps/nmap_cli.v --host 127.0.0.1
DNS & SSL Studio CLI v run cli_apps/dns_cli.v --domain vlang.io
Recon Studio CLI v run cli_apps/recon_cli.v --target vlang.io
Subfinder Studio CLI v run cli_apps/subfinder_cli.v --domain vlang.io
IFConfig Studio CLI v run cli_apps/ifconfig_cli.v --interactive
Crypto Studio CLI v run cli_apps/crypto_cli.v --interactive
Data & Databases JQ Studio CLI v run cli_apps/jq_cli.v --interactive
Data Convert CLI v run cli_apps/dataconvert_cli.v --interactive
SQLite Studio CLI v run cli_apps/sqlite_cli.v --interactive
Text & Search GAWK Studio CLI v run cli_apps/gawk_cli.v --interactive
Sed Studio CLI v run cli_apps/sed_cli.v --interactive
SD Studio CLI v run cli_apps/sd_cli.v --interactive
Cut Studio CLI v run cli_apps/cut_cli.v --interactive
TR Studio CLI v run cli_apps/tr_cli.v --interactive
Regex Studio CLI v run cli_apps/regex_cli.v --interactive
Ripgrep Studio CLI v run cli_apps/rg_cli.v --interactive
FD Studio CLI v run cli_apps/fd_cli.v --interactive
Find Studio CLI v run cli_apps/find_cli.v --interactive
Text Editor CLI v run cli_apps/text_editor_cli.v --interactive
Media & Vision FFmpeg Media CLI v run cli_apps/ffmpeg_cli.v --interactive
ImageMagick CLI v run cli_apps/imagemagick_cli.v --interactive
yt-dlp Studio CLI v run cli_apps/yt_dlp_cli.v --interactive
Audio Tag Studio CLI v run cli_apps/audiotag_cli.v --interactive
ExifTool Studio CLI v run cli_apps/exif_cli.v --interactive
Tesseract OCR CLI v run cli_apps/ocr_cli.v --interactive
Say Speech CLI v run cli_apps/say_cli.v --interactive
Media Studio Hub CLI v run cli_apps/media_studio_cli.v --interactive
Graphviz DOT CLI v run cli_apps/dot_cli.v --interactive
Math & Calculators Numbat Units CLI v run cli_apps/numbat_cli.v --interactive
Kalker Math CLI v run cli_apps/kalker_cli.v --interactive
Qalc Studio CLI v run cli_apps/qalc_cli.v --interactive
Programmer Calc CLI v run cli_apps/calc_cli.v --interactive
Statistics Studio CLI v run cli_apps/statistics_cli.v --interactive
Graph Studio CLI v run cli_apps/graph_cli.v --interactive
Doc & Archives Pandoc Studio CLI v run cli_apps/pandoc_cli.v --interactive
Ouch Archive CLI v run cli_apps/ouch_cli.v --interactive
Wget2 Downloader CLI v run cli_apps/wget2_cli.v --interactive

🍺 Homebrew Dependencies Installation

Many client applications integrate with standard developer CLI utilities (ripgrep, jq, ffmpeg, imagemagick, pandoc, ouch, nmap, etc.).

You can inspect and automatically install all missing Homebrew tools using install_deps.vsh:

# Check installed and missing tools report:
v run install_deps.vsh --check

# Automatically install all missing formula dependencies via Homebrew:
v run install_deps.vsh

# Check dependencies for a specific application:
v run install_deps.vsh --app jq_cli

⚡ Batch Compilation

Compile all 49 CLI tools into the bin/ directory concurrently:

# Fast dev build with 6 parallel jobs:
v run compile_cli_apps.vsh

# Production optimized build (-prod):
v run compile_cli_apps.vsh -prod

# Compile a specific tool:
v run compile_cli_apps.vsh calc

🧪 Running Tests

Run the test suite across all modules:

v test .

📖 API Reference

For detailed documentation, method signatures, and advanced usage patterns, see CLI_API.md.


📄 License

MIT License - see LICENSE for details.

About

SimpleCLI is a comprehensive, lightweight, zero-window console utility framework and Rapid Application Development (RAD) toolkit for the V programming language.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages