talos/internal/app/osctl/cmd/ps.go
2018-12-19 22:22:05 -08:00

39 lines
722 B
Go

// nolint: dupl,golint
package cmd
import (
"fmt"
"os"
"github.com/autonomy/talos/internal/app/osctl/internal/client"
"github.com/autonomy/talos/internal/pkg/constants"
"github.com/spf13/cobra"
)
// psCmd represents the processes command
var psCmd = &cobra.Command{
Use: "ps",
Short: "List processes",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
creds, err := client.NewDefaultClientCredentials()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
c, err := client.NewClient(constants.OsdPort, creds)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
if err := c.Processes(); err != nil {
fmt.Println(err)
os.Exit(1)
}
},
}
func init() {
rootCmd.AddCommand(psCmd)
}