chore: update command handlers to return 'handled' boolean

### CHANGES

- Add `handled` boolean return to command handlers
- Modify `handleSetupAndServerCommands` to use `handled`
- Update `handleConfigurationCommands` with `handled` logic
- Implement `handled` return in `handleExtensionCommands`
- Revise `handleListingCommands` to support `handled` return
- Adjust `handleManagementCommands` to return `handled`
This commit is contained in:
Kayvan Sylvan
2025-07-09 02:57:29 -07:00
parent 137aff2268
commit b884c529bd
7 changed files with 45 additions and 39 deletions

View File

@@ -6,24 +6,25 @@ import (
)
// handleSetupAndServerCommands handles setup and server-related commands
func handleSetupAndServerCommands(currentFlags *Flags, registry *core.PluginRegistry, version string) (err error) {
// Returns (handled, error) where handled indicates if a command was processed and should exit
func handleSetupAndServerCommands(currentFlags *Flags, registry *core.PluginRegistry, version string) (handled bool, err error) {
// if the setup flag is set, run the setup function
if currentFlags.Setup {
err = registry.Setup()
return
return true, err
}
if currentFlags.Serve {
registry.ConfigureVendors()
err = restapi.Serve(registry, currentFlags.ServeAddress, currentFlags.ServeAPIKey)
return
return true, err
}
if currentFlags.ServeOllama {
registry.ConfigureVendors()
err = restapi.ServeOllama(registry, currentFlags.ServeAddress, version)
return
return true, err
}
return nil
return false, nil
}