scim/pkg/cmd/root.go

36 lines
522 B
Go
Raw Normal View History

2022-06-10 11:51:19 +00:00
package cmd
import (
"context"
2022-06-16 08:14:40 +00:00
"fmt"
"os"
2022-06-10 11:51:19 +00:00
"os/signal"
"syscall"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "scim",
Short: "A tool to quickly setup SCIM",
}
func Execute() {
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
defer cancel()
ctx, stop := signal.NotifyContext(ctx, syscall.SIGINT, syscall.SIGTERM)
defer stop()
cobra.CheckErr(rootCmd.ExecuteContext(ctx))
}
func init() {
}
func CheckErr(err error) {
if err != nil {
2022-06-16 08:14:40 +00:00
fmt.Print(err)
os.Exit(1)
2022-06-10 11:51:19 +00:00
}
}