Compare commits

..

No commits in common. 'master' and 'v0.5.2' have entirely different histories.

@ -435,7 +435,7 @@ func (h *Hostlist) Format() []byte {
switch format {
case "windows":
return h.FormatWindows()
case "unix":
case "linux":
return h.FormatLinux()
default:
// Theoretically the Windows format might be more compatible but there

@ -59,11 +59,6 @@ func ExitWithError(err error) {
}
}
func Usage() {
fmt.Print(help, hostess.GetHostsPath())
os.Exit(0)
}
func CommandUsage(command string) error {
return fmt.Errorf("Usage: %s %s <hostname>", os.Args[0], command)
}
@ -71,13 +66,13 @@ func CommandUsage(command string) error {
func wrappedMain(args []string) error {
cli := flag.NewFlagSet(args[0], flag.ExitOnError)
preview := cli.Bool("n", false, "preview")
cli.Usage = Usage
cli.Usage = func() {
fmt.Printf(help, hostess.GetHostsPath())
}
command := ""
if len(args) > 1 {
command = args[1]
} else {
Usage()
}
if err := cli.Parse(args[2:]); err != nil {

@ -288,15 +288,3 @@ func TestExitCodeFmt(t *testing.T) {
t.Fatalf("---- Expected ----\n%s\n---- Found ----\n%s\n", finalExpected, string(state3))
}
}
func TestNoCommand(t *testing.T) {
if err := wrappedMain([]string{"main"}); err != nil {
t.Fatal(err)
}
}
func TestNoArgs(t *testing.T) {
if err := wrappedMain([]string{"main", ""}); err != nil {
t.Fatal(err)
}
}

Loading…
Cancel
Save