Feat: reboot bridge + Fix: cli panic
This commit is contained in:
parent
74d9ac7346
commit
8c3051b11c
|
@ -411,3 +411,12 @@ func cmdAdopt(br *ziggy.Bridge, args []string) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func cmdReboot(br *ziggy.Bridge, args []string) error {
|
||||
resp, err := br.UpdateConfig(&huego.Config{Reboot: true})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Info().Msgf("%v", resp)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ func init() {
|
|||
"fwup", "upgrade", "fwupdate")
|
||||
Commands["info"] = newZiggsCommand(cmdInfo, "show information about a bridge", 0, "uname")
|
||||
initCompletion()
|
||||
Commands["reboot"] = newZiggsCommand(cmdReboot, "reboot bridge", 0)
|
||||
}
|
||||
|
||||
func initCompletion() {
|
||||
|
|
|
@ -41,7 +41,7 @@ type CompletionManager struct {
|
|||
|
||||
// GetSelectedSuggestion returns the selected item.
|
||||
func (c *CompletionManager) GetSelectedSuggestion() (s Suggest, ok bool) {
|
||||
if c.selected == -1 {
|
||||
if c.selected == -1 || len(c.tmp) == 0 {
|
||||
return Suggest{}, false
|
||||
} else if c.selected < -1 {
|
||||
debug.Assert(false, "must not reach here")
|
||||
|
|
|
@ -30,6 +30,7 @@ type Config struct {
|
|||
DatastoreVersion string `json:"datastoreversion,omitempty"`
|
||||
StarterKitID string `json:"starterkitid,omitempty"`
|
||||
InternetService InternetService `json:"internetservices,omitempty"`
|
||||
Reboot bool `json:"reboot,omitempty"`
|
||||
}
|
||||
|
||||
// SwUpdate contains information related to software updates. Deprecated in 1.20
|
||||
|
|
Loading…
Reference in New Issue