How manudiv16/eaws works
Project Type and Purpose
• EAWS is a Go-based CLI tool built with Cobra for interacting with AWS services (ECS, CloudWatch Logs, CodePipeline).
File Structure
• cmd/: Houses each Cobra command (container, logs, pipeline, root).
• main.go & cmd/root.go: CLI entry point and initialization.
• scripts & config: install.sh, uninstall.sh, setup-completion.sh for installation; .github/workflows for CI/CD.
• Formula/: Homebrew formula for package distribution.
Main Components
a. Client Layer (CLI Frontend)
• User’s Terminal
• eaws binary (main.go + cmd/ package)
• Cobra command parser & promptui interactive prompts
b. Application Logic Layer
• Command handlers (container.go, logs_query.go, pipeline.go, etc.)
• internal/utils for:
• AWS SDK v2 wrappers
• AWS profile resolution (including granted integration)
c. External Dependencies
• AWS SDK for Go v2 (network calls to AWS APIs)
• promptui library (interactive selection)
d. AWS Services (Remote)
• Amazon ECS
• CloudWatch Logs
• CodePipeline
e. Configuration & Environment
• AWS credentials & profiles (~/.aws)
• Environment variables (AWS_PROFILE, NO_COLOR)
f. Deployment/Installation
• Shell install scripts (install.sh/uninstall.sh)
• Homebrew Formula
• CI/CD pipelines (.github/workflows)
Relationships & Data Flow
• User types eaws <command> → Cobra parses command → invokes corresponding handler.
• Handler uses internal/utils to:
• Resolve AWS profile (CLI flag, env var, granted)
• Initialize AWS SDK client
• Make API calls to AWS services
• Process & format response
• Render colorized output or interactive prompt.
• CLI → Command Parser → Handler → AWS SDK → AWS Service
• AWS Service → AWS SDK → Handler → CLI Output.
• Side-flows:
• CLI reads config from local file system
• Installation scripts write binary to /usr/local/bin / Homebrew.
Key Architectural Patterns
• Modular CLI commands via Cobra (each command in its own file).
• Adapter/Wrapper pattern in internal/utils around AWS SDK.
• Separation of concerns: parsing, business logic, AWS integration, and output formatting are distinct modules.
• Interactive UI abstraction via promptui.