github.com/omnigres/cli@v0.1.4/cmd/stop.go (about)

     1  package cmd
     2  
     3  import (
     4  	"context"
     5  	"github.com/charmbracelet/log"
     6  	"github.com/omnigres/cli/orb"
     7  	"github.com/spf13/cobra"
     8  )
     9  
    10  // stopCmd represents the stop command
    11  var stopCmd = &cobra.Command{
    12  	Use:   "stop",
    13  	Short: "Stop running cluster",
    14  	Run: func(cmd *cobra.Command, args []string) {
    15  		var cluster orb.OrbCluster
    16  		var err error
    17  		cluster, err = getOrbCluster()
    18  		if err != nil {
    19  			log.Fatal(err)
    20  		}
    21  		ctx := context.Background()
    22  		err = cluster.Stop(ctx)
    23  		if err != nil {
    24  			log.Fatal(err)
    25  		}
    26  	},
    27  }
    28  
    29  func init() {
    30  	rootCmd.AddCommand(stopCmd)
    31  }