A modern command-line interface template built with Bubble Tea for interactive TUI functionality and Lipgloss for beautiful styling.
- What is this project?
- Requirements
- Quick Start
- Usage
- Go Installation Guide
- Project Structure
- Development
This template provides a foundation for creating interactive command-line applications in Go. It demonstrates:
- Interactive TUI: Menu navigation with keyboard controls
- Beautiful styling: Colors, borders, and typography with Lipgloss
- CLI framework: Cobra for command structure and flags
- Clean architecture: Organized project structure following Go conventions
Perfect for building tools like file managers, system monitors, configuration utilities, or any CLI that benefits from interactive menus.
- Go 1.21 or later
- Terminal with color support (most modern terminals)
# Clone or download this template
git clone [email protected]:TahaTesser/go-cli-template.git
cd go-cli-template
# Install dependencies
go mod download
# Build the application
go build -o cli-app
# Run the interactive CLI
./cli-app./cli-appNavigate with:
↑/↓orj/k- Move cursorSpace/Enter- Select optionsqorCtrl+C- Quit
./cli-app --help # Show help
./cli-app --config config.yml # Use config file
./cli-app --verbose # Enable verbose outputNew to Go? Here's how to get started:
macOS (Homebrew):
brew install goLinux/macOS (Manual):
# Download from https://golang.org/dl/
wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrcWindows: Download installer from golang.org/dl
go version # Should show Go version 1.21+go mod init my-project # Initialize new project
go mod download # Download dependencies
go build # Build executable
go run main.go # Build and run directly
go test ./... # Run tests.
├── cmd/
│ └── root.go # CLI commands and flags
├── internal/
│ ├── tui/
│ │ ├── model.go # Application state
│ │ ├── update.go # Input handling
│ │ └── view.go # UI rendering
│ └── styles/
│ └── styles.go # Colors and styling
├── main.go # Entry point
├── go.mod # Dependencies
└── README.md
# Development build
go build -o cli-app
# Cross-platform builds
GOOS=linux GOARCH=amd64 go build -o cli-app-linux
GOOS=windows GOARCH=amd64 go build -o cli-app.exe
GOOS=darwin GOARCH=amd64 go build -o cli-app-mac- New commands: Add to
cmd/root.go - UI changes: Modify files in
internal/tui/ - Styling: Update
internal/styles/styles.go - Dependencies:
go get package-name
go test ./... # Run all tests
go test -cover ./... # With coverage
go test -v ./internal/tui/ # Specific packageBuilt with ❤️ using Bubble Tea and Lipgloss