mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-10 06:48:04 -05:00
### 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`
29 lines
794 B
Go
29 lines
794 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/danielmiessler/fabric/internal/core"
|
|
)
|
|
|
|
// handleConfigurationCommands handles configuration-related commands
|
|
// Returns (handled, error) where handled indicates if a command was processed and should exit
|
|
func handleConfigurationCommands(currentFlags *Flags, registry *core.PluginRegistry) (handled bool, err error) {
|
|
if currentFlags.UpdatePatterns {
|
|
if err = registry.PatternsLoader.PopulateDB(); err != nil {
|
|
return true, err
|
|
}
|
|
// Save configuration in case any paths were migrated during pattern loading
|
|
err = registry.SaveEnvFile()
|
|
return true, err
|
|
}
|
|
|
|
if currentFlags.ChangeDefaultModel {
|
|
if err = registry.Defaults.Setup(); err != nil {
|
|
return true, err
|
|
}
|
|
err = registry.SaveEnvFile()
|
|
return true, err
|
|
}
|
|
|
|
return false, nil
|
|
}
|