pull/38/head
Chris Bednarski 4 years ago
parent ba102742d4
commit 9c247955f6

@ -18,7 +18,7 @@ const (
type Options struct { type Options struct {
IPVersion int IPVersion int
Preview bool Preview bool
} }
// PrintErrLn will print to stderr followed by a newline // PrintErrLn will print to stderr followed by a newline
@ -259,7 +259,6 @@ func Apply(options *Options, filename string) error {
return err return err
} }
if err := hostfile.Hosts.Apply(jsonbytes); err != nil { if err := hostfile.Hosts.Apply(jsonbytes); err != nil {
return fmt.Errorf("Error applying changes to hosts file: %s", err) return fmt.Errorf("Error applying changes to hosts file: %s", err)
} }

@ -2,14 +2,14 @@ package main
import ( import (
"testing" "testing"
) )
func TestStrPadRight(t *testing.T) { func TestStrPadRight(t *testing.T) {
type testCase struct { type testCase struct {
Expected string Expected string
Output string Output string
Name string Name string
} }
cases := []testCase{ cases := []testCase{

@ -67,9 +67,9 @@ func CommandUsage(command string) error {
func wrappedMain() error { func wrappedMain() error {
cli := flag.NewFlagSet(os.Args[0], flag.ExitOnError) cli := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
ipv4 := cli.Bool("4",false, "IPv4") ipv4 := cli.Bool("4", false, "IPv4")
ipv6 := cli.Bool("6",false, "IPv6") ipv6 := cli.Bool("6", false, "IPv6")
preview := cli.Bool("n",false, "preview") preview := cli.Bool("n", false, "preview")
cli.Usage = func() { cli.Usage = func() {
fmt.Printf(help, hostess.GetHostsPath()) fmt.Printf(help, hostess.GetHostsPath())
} }
@ -83,10 +83,10 @@ func wrappedMain() error {
Preview: *preview, Preview: *preview,
} }
if *ipv4 { if *ipv4 {
options.IPVersion = options.IPVersion| IPv4 options.IPVersion = options.IPVersion | IPv4
} }
if *ipv6 { if *ipv6 {
options.IPVersion = options.IPVersion| IPv6 options.IPVersion = options.IPVersion | IPv6
} }
command := cli.Arg(0) command := cli.Arg(0)

Loading…
Cancel
Save