cmd/instance.go
changeset 0 5abace724584
child 37 9bc03db114c3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmd/instance.go	Wed Apr 19 19:08:47 2017 +0200
@@ -0,0 +1,39 @@
+// Copyright © 2017 Mikael Berthe <mikael@lilotux.net>
+//
+// Licensed under the MIT license.
+// Please see the LICENSE file is this directory.
+
+package cmd
+
+import (
+	"github.com/spf13/cobra"
+)
+
+// timelinesCmd represents the timelines command
+var instanceCmd = &cobra.Command{
+	Use:   "instance",
+	Short: "Display current instance information",
+	RunE:  instanceRunE,
+}
+
+func init() {
+	RootCmd.AddCommand(instanceCmd)
+}
+
+func instanceRunE(cmd *cobra.Command, args []string) error {
+	if err := madonInit(false); err != nil {
+		return err
+	}
+
+	i, err := gClient.GetCurrentInstance()
+	if err != nil {
+		errPrint("Error: %s", err.Error())
+		return nil
+	}
+
+	p, err := getPrinter()
+	if err != nil {
+		return err
+	}
+	return p.PrintObj(i, nil, "")
+}