26 lines
621 B
Go
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)
|
|
}
|
|
|
|
}
|