Files
old-confighub/chub/init.go
2015-05-30 11:02:31 +02:00

26 lines
621 B
Go

package main
import (
"fmt"
"github.com/edindazdarevic/confighub/chub/client"
"github.com/edindazdarevic/confighub/chub/globals"
"os"
"runtime"
)
func initCommand(guid string) {
configuration := config{MachineGuid: guid}
saveGuidToHomedir(configuration)
hostname, err := os.Hostname()
globals.PanicWithStyle("Something is terribly wrong. I am sorry. I am so so sorry. :~(", err)
machineToInitialize := client.Machine{hostname, runtime.GOOS, runtime.GOARCH, guid}
finishedOk := client.Init(&machineToInitialize)
if finishedOk {
fmt.Printf("Successfuly initialized the machine with id %v\n", guid)
}
}