How melkeydev/govm works
Main components
• CLI/TUI Interface: The entry point (main.go) handles both command-line commands and the interactive TUI (built using Charm’s Bubbletea library). This component is responsible for receiving user commands like “install”, “use”, “list”, and “help.”
• Internal Modules:
• internal/cli – Contains logic for parsing CLI commands.
• internal/model – Manages the core data structures and business logic behind version management.
• internal/setup – Handles the initial setup (e.g., guiding users through adding the shim directory to PATH).
• internal/styles – Provides styling definitions for the TUI, leveraging libraries like Lipgloss and Charm Bubbles.
• internal/utils – Contains common utilities and helper functions (including version-related utilities).
• External Dependencies & Integrations:
• The official Go download site (go.dev) which is used to fetch and install Go versions.
• The “shim” directory in the user’s home (~/.govm/shim), which acts as a redirector to the currently active Go version.
• Infrastructure & DevOps:
• GitHub workflows, issue templates, and other GitHub configurations are present for CI/CD, semantic versioning with goreleaser, and community contributions.
Understand the relationships and interactions
• The user interacts either with the TUI or directly via CLI.
• The main entry point (main.go) routes commands to components in internal/cli.
• The CLI interacts with the core model (internal/model) to execute version management commands.
• The setup component (internal/setup) is invoked during the first-time setup to ensure the shim directory is updated in the user's PATH.
• Styling for the TUI is handled by the internal/styles module, which uses external libraries like Bubbletea, Bubbles, and Lipgloss.
• Utility functions in internal/utils support tasks like version parsing, constant definitions, and managing the overall state.