Browse Source

feat(tui): remove share commands from help if sharing is disabled (#1087)

Timo Clasen 7 months ago
parent
commit
a493aec174
1 changed files with 4 additions and 0 deletions
  1. 4 0
      packages/tui/internal/commands/command.go

+ 4 - 0
packages/tui/internal/commands/command.go

@@ -344,6 +344,10 @@ func LoadFromConfig(config *opencode.Config) CommandRegistry {
 	marshalled, _ := json.Marshal(config.Keybinds)
 	marshalled, _ := json.Marshal(config.Keybinds)
 	json.Unmarshal(marshalled, &keybinds)
 	json.Unmarshal(marshalled, &keybinds)
 	for _, command := range defaults {
 	for _, command := range defaults {
+		// Remove share/unshare commands if sharing is disabled
+		if config.Share == opencode.ConfigShareDisabled && (command.Name == SessionShareCommand || command.Name == SessionUnshareCommand) {
+			continue
+		}
 		if keybind, ok := keybinds[string(command.Name)]; ok && keybind != "" {
 		if keybind, ok := keybinds[string(command.Name)]; ok && keybind != "" {
 			command.Keybindings = parseBindings(keybind)
 			command.Keybindings = parseBindings(keybind)
 		}
 		}