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`
32 lines
878 B
Go
32 lines
878 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/danielmiessler/fabric/internal/plugins/db/fsdb"
|
|
)
|
|
|
|
// handleManagementCommands handles management-related commands (delete, print, etc.)
|
|
// Returns (handled, error) where handled indicates if a command was processed and should exit
|
|
func handleManagementCommands(currentFlags *Flags, fabricDb *fsdb.Db) (handled bool, err error) {
|
|
if currentFlags.WipeContext != "" {
|
|
err = fabricDb.Contexts.Delete(currentFlags.WipeContext)
|
|
return true, err
|
|
}
|
|
|
|
if currentFlags.WipeSession != "" {
|
|
err = fabricDb.Sessions.Delete(currentFlags.WipeSession)
|
|
return true, err
|
|
}
|
|
|
|
if currentFlags.PrintSession != "" {
|
|
err = fabricDb.Sessions.PrintSession(currentFlags.PrintSession)
|
|
return true, err
|
|
}
|
|
|
|
if currentFlags.PrintContext != "" {
|
|
err = fabricDb.Contexts.PrintContext(currentFlags.PrintContext)
|
|
return true, err
|
|
}
|
|
|
|
return false, nil
|
|
}
|