Skip to content

jagoff/universal-shell-gui-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 Universal Shell GUI Framework

The definitive standard for beautiful, modern CLI interfaces in shell projects

License: MIT Shell: Bash/Zsh GUI: Gum

A universal framework for creating stunning, interactive command-line interfaces using gum. This framework provides a standardized approach to building modern, user-friendly shell applications with consistent design patterns and robust error handling.

✨ Features

  • 🎯 Universal: Works with any shell project (bash, zsh, etc.)
  • 🎨 Beautiful: Modern, colorful interfaces with emojis and icons
  • πŸ”§ Robust: Compatible with all versions of gum
  • πŸ“± Interactive: Menus, confirmations, multi-select, and more
  • πŸ›‘οΈ Safe: TTY detection and error handling
  • πŸ“š Well-documented: Complete examples and best practices
  • πŸš€ Fast: Lightweight and efficient

πŸš€ Quick Start

1. Install Dependencies

# Install gum (required)
brew install gum

# Verify installation
gum --version

2. Include the Framework

#!/bin/bash
# Your script with beautiful GUI

# Include the framework
source ./gui_framework.sh

# Use the functions
main() {
    local action=$(show_gui_menu \
        "My Project" \
        "Select the action you want to perform" \
        "Choose an option:" \
        "πŸš€ Install" \
        "βš™οΈ  Configure" \
        "▢️  Run" \
        "❌ Exit")
    
    case "$action" in
        "πŸš€ Install") install_project ;;
        "βš™οΈ  Configure") configure_project ;;
        "▢️  Run") run_project ;;
        "❌ Exit") exit 0 ;;
    esac
}

main "$@"

πŸ“ Repository Structure

universal-shell-gui-framework/
β”œβ”€β”€ README.md                 # This file
β”œβ”€β”€ gui_framework.sh          # Core framework
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ basic_example.sh      # Simple example
β”‚   β”œβ”€β”€ advanced_example.sh   # Complex example
β”‚   └── project_template.sh   # Project template
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ FRAMEWORK_GUIDE.md    # Complete framework guide
β”‚   β”œβ”€β”€ BEST_PRACTICES.md     # Best practices
β”‚   β”œβ”€β”€ COMPONENTS.md         # Available components
β”‚   └── EXAMPLES.md           # More examples
└── templates/
    └── new_project.sh        # Template for new projects

🎯 Core Components

Menus

# Single selection menu
local choice=$(show_gui_menu \
    "Title" \
    "Subtitle" \
    "Header:" \
    "Option 1" \
    "Option 2" \
    "Option 3")

# Multi-selection menu
local selections=$(show_gui_multi_select \
    "Title" \
    "Subtitle" \
    "Header:" \
    3 \
    "Feature 1" \
    "Feature 2" \
    "Feature 3")

Confirmations

if show_gui_confirmation "Do you want to continue?"; then
    echo "User confirmed"
else
    echo "User cancelled"
fi

Input

local name=$(show_gui_input "Enter your name:" "John Doe")

Progress

show_gui_spinner "Installing..." sleep 3

🎨 Design Principles

Color Scheme

  • πŸ”΄ Red: Errors and critical alerts
  • 🟒 Green: Success and confirmations
  • πŸ”΅ Blue: Information and titles
  • 🟑 Yellow: Warnings and prompts
  • 🟣 Purple: Special highlights
  • βšͺ Gray: Secondary text

Icons & Emojis

  • πŸ“‹ Section headers
  • βœ… Success indicators
  • ❌ Error indicators
  • ⚠️ Warnings
  • πŸ”§ Configuration
  • πŸš€ Actions
  • 🎯 Targets

πŸ“š Documentation

πŸ”§ Installation

Option 1: Direct Download

# Download the framework
curl -O https://raw.githubusercontent.com/your-username/universal-shell-gui-framework/main/gui_framework.sh

# Make it executable
chmod +x gui_framework.sh

# Include in your script
source ./gui_framework.sh

Option 2: Git Clone

# Clone the repository
git clone https://github.com/your-username/universal-shell-gui-framework.git

# Copy the framework to your project
cp universal-shell-gui-framework/gui_framework.sh ./gui_framework.sh

# Include in your script
source ./gui_framework.sh

🎯 Usage Examples

Basic Menu

#!/bin/bash
source ./gui_framework.sh

main() {
    local action=$(show_gui_menu \
        "My Application" \
        "What would you like to do?" \
        "Select an action:" \
        "πŸš€ Start" \
        "βš™οΈ  Settings" \
        "πŸ“Š Status" \
        "❌ Quit")
    
    case "$action" in
        "πŸš€ Start") start_app ;;
        "βš™οΈ  Settings") open_settings ;;
        "πŸ“Š Status") show_status ;;
        "❌ Quit") exit 0 ;;
    esac
}

main "$@"

Multi-Step Process

#!/bin/bash
source ./gui_framework.sh

deploy_app() {
    # Step 1: Environment selection
    local env=$(show_gui_menu \
        "Deployment" \
        "Select deployment environment" \
        "Environment:" \
        "🟒 Development" \
        "🟑 Staging" \
        "πŸ”΄ Production")
    
    # Step 2: Confirmation
    if show_gui_confirmation "Deploy to $env?"; then
        # Step 3: Progress
        show_gui_spinner "Deploying to $env..." sleep 5
        log_success "Deployment completed!"
    fi
}

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Charmbracelet for the amazing gum tool
  • The shell scripting community for best practices
  • All contributors who help improve this framework

Made with ❀️ for the shell community

"Beautiful interfaces shouldn't be limited to web apps"

About

Universal, modern, and portable shell GUI framework for bash/zsh scripts using gum. English only.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages