#!/usr/bin/env bash gum style --foreground 212 --bold --border normal --align center --width 50 --margin "1 2" "📝 Docker Logs Viewer" # Get running container names containers=($(docker ps --format "{{.Names}}")) if [ ${#containers[@]} -eq 0 ]; then gum style --foreground 1 "⚠️ No running containers found" exit 1 fi # Select container using gum choose container=$(printf "%s\n" "${containers[@]}" | gum choose --header "Select a container:" --cursor.foreground 212) if [ -z "$container" ]; then exit 0 fi # Select number of lines using gum choose lines=$(gum choose --header "Select number of log lines:" --cursor.foreground 212 \ "5 lines" "10 lines" "25 lines" "50 lines" "100 lines" "200 lines") if [ -z "$lines" ]; then exit 0 fi # Extract number from selection lines=${lines%% *} # Show spinner while fetching logs gum spin --spinner dot --title "Fetching logs..." -- sleep 1 # Show logs docker logs "$container" 2>&1 | tail -n "$lines" | gum pager