Removed -4 and -6 from CLI (these are still usable in the lib)

master
Chris Bednarski 4 years ago
parent 138ef9dcd4
commit c4e4f6d820

@ -60,11 +60,9 @@ hostess may be configured via environment variables.
## IPv4 and IPv6
Your hosts file _may_ contain overlapping entries where the same hostname points
to both an IPv4 and IPv6 IP. In this case, hostess commands will apply to both
entries. Typically you won't have this kind of overlap and the default behavior
is OK. However, if you need to be more granular you can use `-4` or `-6` to
limit operations to entries associated with that type of IP.
It's possible for your hosts file to include overlapping entries for IPv4 and
IPv6. This is an uncommon case so the CLI ignores this distinction. The hostess
library includes logic that differentiates between these cases.
## Contributing

@ -11,13 +11,7 @@ import (
"github.com/cbednarski/hostess/hostess"
)
const (
IPv4 = 1 << iota
IPv6 = 1 << iota
)
type Options struct {
IPVersion int
Preview bool
}

@ -33,8 +33,6 @@ Commands
Flags
-n will preview changes but not rewrite your hosts file
-4 limit changes to IPv4 entries
-6 limit changes to IPv6 entries
Configuration
@ -67,8 +65,6 @@ func CommandUsage(command string) error {
func wrappedMain(args []string) error {
cli := flag.NewFlagSet(args[0], flag.ExitOnError)
ipv4 := cli.Bool("4", false, "IPv4")
ipv6 := cli.Bool("6", false, "IPv6")
preview := cli.Bool("n", false, "preview")
cli.Usage = func() {
fmt.Printf(help, hostess.GetHostsPath())
@ -79,15 +75,8 @@ func wrappedMain(args []string) error {
}
options := &Options{
IPVersion: 0,
Preview: *preview,
}
if *ipv4 {
options.IPVersion = options.IPVersion | IPv4
}
if *ipv6 {
options.IPVersion = options.IPVersion | IPv6
}
command := cli.Arg(0)
switch command {

Loading…
Cancel
Save