35 lines
522 B
Go
35 lines
522 B
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"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 {
|
|
fmt.Print(err)
|
|
os.Exit(1)
|
|
}
|
|
}
|