tidepool-gvm 0.1.3

Go Version Manager CLI - Simple and fast Go version switching
Documentation

tidepool-gvm

πŸ“– Language: English | δΈ­ζ–‡

A command-line interface for Go version management, providing an intuitive and user-friendly way to install, switch, and manage Go versions across platforms.

Overview

tidepool-gvm is the CLI component of the Tidepool project that provides the gvm command. It's built on top of the tidepool-version-manager core library and offers a modern, package manager-style interface for Go version management.

Installation

Via Cargo

cargo install tidepool-gvm

This installs the binary as gvm command.

From Source

git clone https://github.com/Slothtron/tidepool.git

cd tidepool

cargo build --release --package tidepool-gvm

The binary will be available at target/release/gvm (or gvm.exe on Windows).

Usage

Basic Commands

# Install a Go version

gvm install 1.21.3


# Switch to a Go version

gvm use 1.21.3


# List installed versions

gvm list


# List available versions for download

gvm list --available


# Show current status

gvm status


# Show version information

gvm info 1.21.3


# Uninstall a version

gvm uninstall 1.20.5


# Update available versions cache

gvm update


# Show configuration

gvm config


# Show help

gvm --help

Advanced Options

# Force installation (overwrite existing)

gvm install 1.21.3 --force


# Global setting (persistent across terminals)

gvm use 1.21.3 --global


# Custom installation directory

gvm install 1.21.3 --install-dir /opt/go-versions


# Verbose output

gvm install 1.21.3 --verbose

Features

  • πŸ”„ Version Management: Install, switch, and uninstall Go versions
  • πŸš€ Fast Operations: Asynchronous downloads with progress display
  • πŸ›‘οΈ Safety: Protection against accidental deletion of active versions
  • 🌍 Cross-Platform: Works on Windows, macOS, and Linux
  • 🎨 Modern UI: Colorful terminal output and progress indicators
  • βš™οΈ Environment Management: Automatic GOROOT, GOPATH, and PATH configuration

Configuration

GVM stores configuration in platform-specific directories:

  • Windows: %APPDATA%\gvm\config.toml
  • macOS/Linux: ~/.config/gvm/config.toml

Example Configuration

[gvm]

install_dir = "/usr/local/go-versions"

download_dir = "/tmp/gvm-downloads"

mirror = "official"

cleanup_downloads = true

concurrent_connections = 4

Environment Variables

After switching to a Go version, GVM automatically configures:

GOROOT="/usr/local/go-versions/1.21.3"
GOPATH="$HOME/go"  # if not already set

PATH="$GOROOT/bin:$GOPATH/bin:$PATH"

Development

This CLI tool is built using:

Project Structure

cli/tidepool-gvm/
β”œβ”€β”€ Cargo.toml          # Package configuration
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs         # Main entry point
β”‚   β”œβ”€β”€ lib.rs          # Library interface
β”‚   β”œβ”€β”€ cli.rs          # Command-line parsing
β”‚   β”œβ”€β”€ commands.rs     # Command implementations
β”‚   β”œβ”€β”€ config.rs       # Configuration management
β”‚   └── ui.rs          # User interface helpers
β”œβ”€β”€ examples/           # Usage examples
└── tests/             # Integration tests

Building

# Development build

cargo build --package tidepool-gvm


# Release build

cargo build --release --package tidepool-gvm


# Run tests

cargo test --package tidepool-gvm


# Run with debug logging

RUST_LOG=debug cargo run --package tidepool-gvm -- install 1.21.3

Architecture

The CLI follows a clean architecture pattern:

  1. CLI Layer (cli.rs): Parses command-line arguments using clap
  2. Command Layer (commands.rs): Implements business logic for each command
  3. UI Layer (ui.rs): Handles user interface and terminal output
  4. Config Layer (config.rs): Manages application configuration
  5. Core Layer: Uses tidepool-version-manager for actual version management

Error Handling

The CLI provides user-friendly error messages and suggestions:

$ gvm use 1.21.3

❌ Go version 1.21.3 is not installed


πŸ’‘ Suggestions:

   1. Install it first: gvm install 1.21.3

   2. List available versions: gvm list --available

License

This project is licensed under the MIT License. See LICENSE for details.

Contributing

Contributions are welcome! Please see the main project's Contributing Guide for details.