Skip to content

A web application designed to seamlessly capture and organize commands from both the web and the command-line interface.

License

Notifications You must be signed in to change notification settings

ftsiadimos/CMD-Repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Command-CLI

Docker License Python

A lightweight Flask application for storing, searching, and managing your shell commands with both a web UI and CLI client.

Command-CLI UI


✨ Features

  • 🌐 Web Interface β€” Clean Bootstrap 5 UI with search, pagination, and mobile support
  • πŸ’» CLI Client β€” Pure Bash client for terminal workflows (repocomcli)
  • πŸ” Search β€” Full-text search across commands, descriptions, and tags
  • πŸ“‹ Copy to Clipboard β€” One-click copy from web or CLI
  • πŸ“€ Export/Import β€” Backup and restore your commands as JSON
  • 🐳 Docker Ready β€” Easy deployment with persistent storage
  • 🏷️ Tagging β€” Organize commands with comma-separated tags

πŸš€ Quick Start

Option 1: Docker (Recommended)

# Pull and run with persistent storage
docker run -d \
  --name command-cli \
  --restart unless-stopped \
  -p 5001:5001 \
  -v command-cli-data:/app/instance \
  ftsiadimos/command-cli-image:latest

Open http://localhost:5001 in your browser.

Option 2: Manual Installation

# Clone the repository
git clone https://github.com/ftsiadimos/command-cli-repo
cd command-cli-repo

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run the application
python app.py

Open http://127.0.0.1:5000 in your browser.


πŸ–₯️ CLI Client (repocomcli)

A pure Bash CLI client for managing commands from the terminal.

Installation

# Copy to your PATH
sudo cp repocomcli /usr/local/bin/
sudo chmod +x /usr/local/bin/repocomcli

# Configure the server (if not localhost)
repocomcli config set 192.168.1.100 --port 5001

Requirements

  • curl (required)
  • jq (recommended for better output)
  • xclip or xsel (optional, for clipboard support)

Usage

# Add a new command
repocomcli add "docker ps -a" -d "List all containers" -t "docker"

# List all commands
repocomcli list

# Search commands
repocomcli list -s docker

# Show specific command details
repocomcli show 5

# Copy command to clipboard
repocomcli copy 5

# Export all commands to JSON
repocomcli export backup.json

# Import commands from JSON
repocomcli import backup.json

# View/change configuration
repocomcli config get
repocomcli config set myserver.local --port 5001

CLI Reference

Command Description
add <cmd> [-d desc] [-t tags] Add a new command
list [-s search] [-n limit] List commands with optional search/limit
show <id> Display full details of a command
copy <id> Copy command to clipboard
export <file.json> Export all commands to JSON file
import <file.json> Import commands from JSON file
config get Show current configuration
config set <host> [--port N] Configure API server
--help Show help message
--version Show version

πŸ”Œ API Reference

Endpoints

Method Endpoint Description
GET /api/commands List all commands
GET /api/commands?search=<query> Search commands
POST /api/commands Add a new command
GET /export-json Export all commands as JSON
POST /import-json Import commands from JSON

Examples

Add a command:

curl -X POST http://localhost:5000/api/commands \
  -H "Content-Type: application/json" \
  -d '{
    "command": "find . -name \"*.log\" -mtime +7 -delete",
    "description": "Delete log files older than 7 days",
    "tags": "cleanup,logs,find"
  }'

Search commands:

curl "http://localhost:5000/api/commands?search=docker"

Export all commands:

curl http://localhost:5000/export-json -o backup.json

Exported JSON now includes subcommands (if present). Example exported item:

{
  "id": 42,
  "command": "git",
  "description": "version control",
  "tags": "git",
  "created_at": "2026-02-14T12:00:00",
  "subcommands": [
    { "command": "clone --recursive", "description": "Clone recursively" },
    { "command": "commit -m", "description": "Commit with message" }
  ]
}

You can re-import that file (web UI or CLI) and subcommands will be preserved.---

🐳 Docker Compose

version: '3.8'

services:
  command-cli:
    image: ftsiadimos/command-cli-image:latest
    container_name: command-cli
    restart: unless-stopped
    ports:
      - "5001:5001"
    volumes:
      - command-cli-data:/app/instance

volumes:
  command-cli-data:

πŸ“ Project Structure

command-cli/
β”œβ”€β”€ app.py              # Flask application
β”œβ”€β”€ config.py           # Configuration settings
β”œβ”€β”€ models.py           # SQLAlchemy models
β”œβ”€β”€ forms.py            # WTForms definitions
β”œβ”€β”€ repocomcli          # Bash CLI client
β”œβ”€β”€ requirements.txt    # Python dependencies
β”œβ”€β”€ Dockerfile          # Docker build file
β”œβ”€β”€ docker-compose.yml  # Docker Compose config
β”œβ”€β”€ instance/
β”‚   └── app.db          # SQLite database
β”œβ”€β”€ templates/          # Jinja2 templates
β”‚   β”œβ”€β”€ layout.html
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ add.html
β”‚   β”œβ”€β”€ edit.html
β”‚   β”œβ”€β”€ help.html
β”‚   └── import.html
└── static/
    └── js/             # JavaScript files

πŸ› οΈ Configuration

Environment Variables

Variable Default Description
FLASK_ENV production Flask environment
SECRET_KEY (random) Session secret key

CLI Configuration

The CLI stores its configuration in ~/.config/command-cli/config.json:

{
  "api_base": "192.168.1.100",
  "port": 5001
}

πŸ“ License

This project is licensed under the GPT-3 License.


πŸ‘€ Author

Fotios Tsiadimos


🀝 Contributing

Contributions, issues, and feature requests are welcome!

About

A web application designed to seamlessly capture and organize commands from both the web and the command-line interface.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published