mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +00:00
- Introduced a single context in main() to handle interrupt signals (os.Interrupt, syscall.SIGTERM). - Removed repetitive context creation in the program by reusing the propagated context. - Improved code readability and maintainability by centralizing context management. - Ensured consistent handling of graceful shutdown across the program. Signed-off-by: Ruslan Semagin <pixel.365.24@gmail.com>
22 lines
522 B
Go
22 lines
522 B
Go
package config
|
|
|
|
import (
|
|
"github.com/kubescape/go-logger"
|
|
"github.com/kubescape/kubescape/v3/core/meta"
|
|
v1 "github.com/kubescape/kubescape/v3/core/meta/datastructures/v1"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func getDeleteCmd(ks meta.IKubescape) *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "delete",
|
|
Short: "Delete cached configurations",
|
|
Long: ``,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
if err := ks.DeleteCachedConfig(&v1.DeleteConfig{}); err != nil {
|
|
logger.L().Fatal(err.Error())
|
|
}
|
|
},
|
|
}
|
|
}
|