Txeh

txeh/cmd

Package cmd implements the txeh command-line interface.

import "github.com/txn2/txeh/txeh/cmd"

Package cmd implements the txeh command-line interface.

Variables

Source: txeh/cmd/root.go:43

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
)

Version is the application version, set by goreleaser.

Source: txeh/cmd/version.go:11

var Version = "0.0.0"

Functions

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

Source: txeh/cmd/add.go:59

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

func Execute()

Source: txeh/cmd/root.go:149

Execute bootstraps the cobra root command.

func ListByCIDRs(cidrs []string)

Source: txeh/cmd/list_cidr.go:35

ListByCIDRs lists hostnames for the given CIDR ranges.

func ListByComment(comment string)

Source: txeh/cmd/list_comment.go:31

ListByComment lists hostnames with the given comment.

func ListByHostnames(hostnames []string)

Source: txeh/cmd/list_hosts.go:38

ListByHostnames lists IP addresses for the given hostnames.

func ListByIPs(ips []string)

Source: txeh/cmd/list_ip.go:35

ListByIPs lists hostnames for the given IP addresses.

func RemoveByComment(comment string)

Source: txeh/cmd/remove_comment.go:35

RemoveByComment removes all host entries with the given comment.

func RemoveHosts(hosts []string)

Source: txeh/cmd/remove_host.go:40

RemoveHosts removes the given hostnames from the hosts file.

func RemoveIPRanges(cidrs []string)

Source: txeh/cmd/remove_cidr.go:41

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

func ShowHosts()

Source: txeh/cmd/show.go:26

ShowHosts prints the current hosts file content.

func VersionFromBuild() (version string)

Source: txeh/cmd/version.go:28

VersionFromBuild returns the version of txeh binary.