From c4e4f6d8203625b0ba7a5bf0b780eeceab39c528 Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Sat, 7 Mar 2020 12:04:31 -0800 Subject: [PATCH] Removed -4 and -6 from CLI (these are still usable in the lib) --- README.md | 8 +++----- commands.go | 6 ------ main.go | 11 ----------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 2065c5f..cffd714 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/commands.go b/commands.go index b2c388e..8793a1a 100644 --- a/commands.go +++ b/commands.go @@ -11,13 +11,7 @@ import ( "github.com/cbednarski/hostess/hostess" ) -const ( - IPv4 = 1 << iota - IPv6 = 1 << iota -) - type Options struct { - IPVersion int Preview bool } diff --git a/main.go b/main.go index 760745d..a85fccf 100644 --- a/main.go +++ b/main.go @@ -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 {