github.com/sunriselayer/sunrise-da@v0.13.1-sr3/cmd/cel-shed/main.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  	"os"
     6  	"os/signal"
     7  	"syscall"
     8  
     9  	"github.com/spf13/cobra"
    10  )
    11  
    12  func init() {
    13  	rootCmd.AddCommand(p2pCmd, headerCmd, edsStoreCmd)
    14  }
    15  
    16  var rootCmd = &cobra.Command{
    17  	Use: "cel-shed [subcommand]",
    18  	CompletionOptions: cobra.CompletionOptions{
    19  		DisableDefaultCmd: true,
    20  	},
    21  }
    22  
    23  func main() {
    24  	err := run()
    25  	if err != nil {
    26  		os.Exit(1)
    27  	}
    28  }
    29  
    30  func run() error {
    31  	ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
    32  	defer cancel()
    33  
    34  	return rootCmd.ExecuteContext(ctx)
    35  }