Thanks to visit codestin.com
Credit goes to github.com

Skip to content

razzkumar/gri

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Release Installer (GRI)

A fast, user-friendly command-line tool for installing GitHub releases with automatic platform detection and version management.

Features

  • 🚀 Fast installs: Install latest versions by default
  • 🎯 Smart asset selection: Automatically detects your platform and architecture
  • 🎨 Beautiful UI: Colored output and interactive menus
  • 📦 Package management: List, update, and remove installed packages
  • 🔄 Version control: Install specific versions or choose interactively
  • Simple commands: Intuitive CLI with smart defaults

Quick Start

# Install latest version (fast & simple)
gri cli/cli

# Show interactive version menu
gri cli/cli menu

# Install specific version
gri cli/cli v2.20.0

# List installed packages
gri ls

# Update all packages
gri up

# Remove a package
gri rm cli/cli

Project Structure

gri/
├── main.go              # CLI entry point and command handling
├── go.mod              # Go module definition
└── pkg/
    ├── models/         # Core data structures
    │   └── models.go   # Config, RepInfo, GitHubRelease, Asset
    ├── github/         # GitHub API client
    │   └── client.go   # API interactions
    ├── installer/      # Core installation logic
    │   └── installer.go # ReleaseInstaller and methods
    ├── ui/             # User interface and display
    │   └── ui.go       # Colors, menus, tables, usage
    └── utils/          # File operations and utilities
        └── utils.go    # Archive handling, platform detection

Architecture

The application is structured as a modular Go project with clear separation of concerns:

Core Packages

  • models: Contains all data structures and types
  • github: Handles GitHub API interactions and rate limiting
  • installer: Core business logic for installation, updates, and package management
  • ui: All user interface elements including colors, interactive menus, and formatted output
  • utils: File operations, archive extraction, and platform-specific logic

Design Principles

  • Modularity: Each package has a single responsibility
  • Testability: Clear interfaces make unit testing straightforward
  • Extensibility: Easy to add new features without touching core logic
  • Maintainability: Well-organized code with clear dependencies

Commands

Installation

  • gri <owner>/<repo> - Install latest version
  • gri <owner>/<repo> menu - Show version selection menu
  • gri <owner>/<repo> <version> - Install specific version

Package Management

  • gri ls - List installed packages
  • gri ls <owner>/<repo> - Show versions for repository
  • gri rm <owner>/<repo> - Remove package
  • gri up - Update all packages

Configuration

  • gri set-install-dir <path> - Set the default install directory for binaries (persists in config)

Interactive Options

  • menu, v, versions - Trigger version selection menu

Building

# Build for current platform
go build -o gri .

# Build for multiple platforms
GOOS=linux GOARCH=amd64 go build -o gri-linux .
GOOS=windows GOARCH=amd64 go build -o gri.exe .
GOOS=darwin GOARCH=arm64 go build -o gri-darwin .

Shell Completions

GRI includes shell completion scripts for enhanced command-line experience:

  • Bash: Tab completion for commands, repositories, and version options
  • Zsh: Intelligent completion with descriptions and context-aware suggestions
  • Fish: Rich completions with descriptions and smart argument handling

Installation

The easiest way to install completions is using the built-in command:

# Bash
gri completions bash > ~/.local/share/bash-completion/completions/gri

# Zsh  
gri completions zsh > ~/.zsh/completions/_gri

# Fish
gri completions fish > ~/.config/fish/completions/gri.fish

Alternative manual installation:

# Bash (add to ~/.bashrc)
source completions/gri.bash

# Zsh (copy to completion directory)
cp completions/_gri /usr/local/share/zsh/site-functions/

# Fish (copy to completions directory)
cp completions/gri.fish ~/.config/fish/completions/

See completions/README.md for detailed installation instructions.

Configuration

GRI stores configuration in ~/.config/gri/config.json and installs binaries to ~/.local/bin by default.

Setting the Install Directory

You can change the default install directory for binaries using:

gri set-install-dir /usr/local/bin

This updates the persistent config. You can also override the install directory for the current session by setting the GRI_INSTALL_DIR environment variable:

export GRI_INSTALL_DIR=/custom/path

Precedence:

  • If GRI_INSTALL_DIR is set in the environment, it takes priority over the config value.
  • Otherwise, the value set via gri set-install-dir is used.

Supported Platforms

  • Linux (amd64, arm64, 386, arm)
  • macOS/Darwin (amd64, arm64)
  • Windows (amd64, 386)

Automatically detects platform and selects appropriate assets from GitHub releases.