grin

command module
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 11 Imported by: 0

README

grin

CI Go Report Card Go Reference Release Website Tiny Tool Town

Make INI files greppable.

grin transforms INI files into discrete assignments, making them easy to explore and filter with standard Unix tools like grep, sed, and diff.

Inspired by gron.

Warning: grin is currently beta software. Please make sure you have a backup before using grin on any important files.

Usage

Basic conversion

Text version (click to expand)
$ cat testdata/complex.ini
; Complex configuration example
app-name = SuperApp
version = 2.1

[database]
host = db.example.com
port = 5432
name = mydb

[database.pool]
min = 5
max = 20

[cache]
enabled = true
ttl = 3600

[logging]
level = info
file = /var/log/app.log

$ grin -m testdata/complex.ini
ini = {};
ini.app-name = "SuperApp";
ini.cache = {};
ini.cache.enabled = "true";
ini.cache.ttl = "3600";
ini.database = {};
ini.database.host = "db.example.com";
ini.database.name = "mydb";
ini.database.pool = {};
ini.database.pool.max = "20";
ini.database.pool.min = "5";
ini.database.port = "5432";
ini.logging = {};
ini.logging.file = "/var/log/app.log";
ini.logging.level = "info";
ini.version = "2.1";

Now you can use standard tools to find what you need:

Grep filtering

Text version (click to expand)
$ grin -m testdata/complex.ini | grep database
ini.database = {};
ini.database.host = "db.example.com";
ini.database.name = "mydb";
ini.database.pool = {};
ini.database.pool.max = "20";
ini.database.pool.min = "5";
ini.database.port = "5432";

And reconstruct a filtered INI file with --ungrin:

Ungrin round-trip

Text version (click to expand)
$ grin -m testdata/complex.ini | grep database | grin -u
[database]
host = db.example.com
name = mydb
port = 5432

[database.pool]
max = 20
min = 5
PowerShell

grin works great with PowerShell's Select-String (the grep equivalent):

# Filter INI sections
grin -m config.ini | Select-String "database"

# Multiple patterns
grin -m config.ini | Select-String -Pattern @("database", "cache")

# Round-trip with filtering
grin -m config.ini | Select-String "database" | grin -u

Installation

Homebrew (macOS/Linux)
brew install Yoshi325/tap/grin
Go
go install github.com/Yoshi325/grin@latest
Binary

Download a binary from the latest release.

Options

-u, --ungrin     Reverse the operation (turn assignments back into INI)
-v, --values     Print just the values of provided assignments
-c, --colorize   Colorize output (default on tty)
-m, --monochrome Monochrome (don't colorize output)
    --no-sort    Don't sort output (faster)
    --version    Print version information

Community

🏘️ grin is a proud resident of Tiny Tool Town — Scott Hanselman's neighborhood of free, fun & open source tiny tools.

If you find grin useful, please star this repository! Once we reach 75+ stars, we can submit grin to Homebrew core so anyone can install with just brew install grin.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL