cli/cmd/supervisor_reload.go

41 lines
977 B
Go

package cmd
import (
"fmt"
helper "github.com/home-assistant/cli/client"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var supervisorReloadCmd = &cobra.Command{
Use: "reload",
Aliases: []string{"refresh", "re"},
Short: "Reload the Home Assistant Supervisor updating information",
Long: `
Reloading the Home Assistant Supervisor, triggers the Supervisor to regather
all data it currently has, including checking for updates.`,
Example: `
ha supervisor reload`,
Run: func(cmd *cobra.Command, args []string) {
log.WithField("args", args).Debug("supervisor reload")
section := "supervisor"
command := "reload"
base := viper.GetString("endpoint")
resp, err := helper.GenericJSONPost(base, section, command, nil)
if err != nil {
fmt.Println(err)
ExitWithError = true
} else {
ExitWithError = !helper.ShowJSONResponse(resp)
}
},
}
func init() {
supervisorCmd.AddCommand(supervisorReloadCmd)
}