Pages
Getting Started
Get up and running with txeh in under 5 minutes.
Get up and running with txeh in under 5 minutes.
Install the CLI
Homebrew (macOS/Linux)
brew install txn2/tap/txehGo Install
go install github.com/txn2/txeh/txeh@latestBinary Download
Download the latest release from GitHub Releases for your platform.
Your First Commands
Add a hostname:
sudo txeh add 127.0.0.1 myapp.localList hosts for an IP:
txeh list ip 127.0.0.1Remove a hostname:
sudo txeh remove host myapp.localPreview changes without saving (dry run):
sudo txeh add 127.0.0.1 myapp.local --dryrunUse as a Go Library
Add the dependency:
go get github.com/txn2/txehBasic usage:
package main
import (
"fmt"
"github.com/txn2/txeh"
)
func main() {
hosts, err := txeh.NewHostsDefault()
if err != nil {
panic(err)
}
hosts.AddHost("127.0.0.1", "myapp.local")
fmt.Println(hosts.RenderHostsFile())
err = hosts.Save()
if err != nil {
panic(err)
}
}Next Steps
- CLI Reference: Full CLI documentation.
- Go Library: Detailed library usage.
- API Reference: Complete type and method reference.
