| 5 | ) |
| 6 | |
| 7 | func runEnable(filter string, enable bool) { |
| 8 | if err, onShells = doShellSelection(filter, true); err != nil { |
| 9 | log.Fatal("%s", err) |
| 10 | } else if nShells = len(onShells); nShells == 0 { |
| 11 | log.Fatal("no shell selected by the filter %s", filter) |
| 12 | } |
| 13 | |
| 14 | word := "enabled" |
| 15 | if !enable { |
| 16 | word = "disabled" |
| 17 | } |
| 18 | for _, shell := range onShells { |
| 19 | if shell.Enabled == enable { |
| 20 | log.Debug("shell %s already %s", shell.Name, word) |
| 21 | } else { |
| 22 | shell.Enabled = enable |
| 23 | if err := shell.Save(); err != nil { |
| 24 | log.Error("error while setting shell %s to %s: %s", shell.Name, word, err) |
| 25 | } else { |
| 26 | log.Info("shell %s successfully %s", shell.Name, word) |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | } |