handleSetupAndServerCommands handles setup and server-related commands Returns (handled, error) where handled indicates if a command was processed and should exit
(currentFlags *Flags, registry *core.PluginRegistry, version string)
| 8 | // handleSetupAndServerCommands handles setup and server-related commands |
| 9 | // Returns (handled, error) where handled indicates if a command was processed and should exit |
| 10 | func handleSetupAndServerCommands(currentFlags *Flags, registry *core.PluginRegistry, version string) (handled bool, err error) { |
| 11 | // if the setup flag is set, run the setup function |
| 12 | if currentFlags.Setup { |
| 13 | err = registry.Setup() |
| 14 | return true, err |
| 15 | } |
| 16 | |
| 17 | if currentFlags.Serve { |
| 18 | registry.ConfigureVendors() |
| 19 | err = restapi.Serve(registry, currentFlags.ServeAddress, currentFlags.ServeAPIKey) |
| 20 | return true, err |
| 21 | } |
| 22 | |
| 23 | if currentFlags.ServeOllama { |
| 24 | registry.ConfigureVendors() |
| 25 | err = restapi.ServeOllama(registry, currentFlags.ServeAddress, version) |
| 26 | return true, err |
| 27 | } |
| 28 | |
| 29 | return false, nil |
| 30 | } |
no test coverage detected