diff --git a/cmd/octopus/octopus.go b/cmd/octopus/octopus.go index 7c3f802..d19f5d9 100644 --- a/cmd/octopus/octopus.go +++ b/cmd/octopus/octopus.go @@ -3,7 +3,6 @@ package main import ( - "bytes" "flag" "fmt" "log" @@ -11,14 +10,6 @@ import ( "strings" ) -// Each of octopus's tentacles is a remote connection to a host executing the command -type tentacle struct { - host string - hostname string - stdout *bytes.Buffer - err error -} - func main() { identityFile := flag.String("identity-file", "~/.ssh/id_rsa", "identity file used to authenticate to remote hosts") @@ -55,17 +46,3 @@ func main() { os.Exit(numErrors) } - -func (t *tentacle) print() error { - fmt.Println("-----") - fmt.Println(t.hostname) - fmt.Printf("-----\n\n") - o := strings.TrimRight(t.stdout.String(), "\n") - if o != "" { - fmt.Printf("%s\n\n", o) - } - if t.err != nil { - fmt.Printf("Error: %v", t.err) - } - return t.err -} diff --git a/cmd/octopus/tentacle.go b/cmd/octopus/tentacle.go new file mode 100644 index 0000000..54587c6 --- /dev/null +++ b/cmd/octopus/tentacle.go @@ -0,0 +1,28 @@ +package main + +import ( + "bytes" + "fmt" + "strings" +) + +// Each of octopus's tentacles is a remote connection to a host executing the command +type tentacle struct { + hostname string + stdout *bytes.Buffer + err error +} + +func (t *tentacle) print() error { + fmt.Println("-----") + fmt.Println(t.hostname) + fmt.Printf("-----\n\n") + o := strings.TrimRight(t.stdout.String(), "\n") + if o != "" { + fmt.Printf("%s\n\n", o) + } + if t.err != nil { + fmt.Printf("Error: %v\n\n", t.err) + } + return t.err +}