cmd

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package cmd implements the txeh command-line interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	// HostsFileReadPath specifies the host file to read.
	HostsFileReadPath string
	// HostsFileWritePath specifies the path to write the resulting host file.
	HostsFileWritePath string
	// Quiet results in no output.
	Quiet bool
	// DryRun sends output to STDOUT (ignores quiet).
	DryRun bool
	// Flush triggers a DNS cache flush after writing the hosts file.
	Flush bool
	// MaxHostsPerLine limits hostnames per line (0=auto, -1=unlimited, >0=explicit).
	MaxHostsPerLine int
)
View Source
var Version = "0.0.0"

Version is the application version, set by goreleaser.

Functions

func AddHosts

func AddHosts(ip string, hosts []string, comment string)

AddHosts adds hostnames to an IP address with an optional comment.

func Execute

func Execute()

Execute bootstraps the cobra root command.

func ListByCIDRs

func ListByCIDRs(cidrs []string)

ListByCIDRs lists hostnames for the given CIDR ranges.

func ListByComment added in v1.7.0

func ListByComment(comment string)

ListByComment lists hostnames with the given comment.

func ListByHostnames

func ListByHostnames(hostnames []string)

ListByHostnames lists IP addresses for the given hostnames.

func ListByIPs

func ListByIPs(ips []string)

ListByIPs lists hostnames for the given IP addresses.

func RemoveByComment added in v1.7.0

func RemoveByComment(comment string)

RemoveByComment removes all host entries with the given comment.

func RemoveHosts

func RemoveHosts(hosts []string)

RemoveHosts removes the given hostnames from the hosts file.

func RemoveIPRanges

func RemoveIPRanges(cidrs []string)

RemoveIPRanges removes IP addresses in the given CIDR ranges from the hosts file.

func ShowHosts

func ShowHosts()

ShowHosts prints the current hosts file content.

func VersionFromBuild

func VersionFromBuild() (version string)

VersionFromBuild returns the version of txeh binary.

Types

This section is empty.

Jump to

Keyboard shortcuts

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