コード例 #1
0
func TestIdentify(t *testing.T) {
	info, err := platform.Identify()
	if err != nil {
		t.Errorf("got error: %v", err)
	}
	t.Log(info)
}
コード例 #2
0
func TestDetect(t *testing.T) {
	f, err := platform.Identify()
	if err != nil {
		t.Errorf("got error, %v", err)
	}
	t.Log(f)
}
コード例 #3
0
func (s *Removed) stateForSpecificPlatform() (state.State, error) {
	p, err := platform.Identify()
	if err != nil {
		return nil, err
	}
	switch platform.Family(p.Get("family")) {
	case platform.FamilyDebian:
		return &RemovedForDebian{s}, nil
	}
	return nil, errors.New("unsupported platform")
}
コード例 #4
0
func TestMain(m *testing.M) {
	p, err := platform.Identify()
	if err != nil {
		return
	}
	if p.Get("family") != string(platform.FamilyDebian) {
		return
	}

	os.Exit(m.Run())
}
コード例 #5
0
ファイル: main.go プロジェクト: harukasan/orchestra-pit
func usage() {
	usage := `
Usage: opit COMMAND [ARGUMENTS]

opit is a command line interface of orchestra-pit.
`

	fmt.Println(strings.TrimSpace(usage))
	fmt.Println("\nCommands:")
	for name, command := range commands {
		fmt.Printf("  %-8s %s\n", name, command.description())
	}

	fmt.Println("")

	fmt.Println("Use \"opit COMMAND -h\" for more information about the commands.")

	p, err := platform.Identify()
	if err == nil {
		if platform.Family(p.Get("family")) == platform.FamilyDebian {
			fmt.Println("\n -- opit has Super Cow Powers now --")
		}
	}
}