github.com/verrazzano/verrazzano@v1.7.0/tools/psr/psrctl/main.go (about)

     1  // Copyright (c) 2022, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  package main
     5  
     6  import (
     7  	"fmt"
     8  	"os"
     9  
    10  	"github.com/spf13/pflag"
    11  	"github.com/verrazzano/verrazzano/tools/psr/psrctl/cmd/root"
    12  	"github.com/verrazzano/verrazzano/tools/psr/psrctl/pkg/manifest"
    13  	"github.com/verrazzano/verrazzano/tools/vz/cmd/helpers"
    14  	"k8s.io/cli-runtime/pkg/genericclioptions"
    15  )
    16  
    17  func main() {
    18  	// Extract the manifests and write them to a temp directory
    19  	// This sets the global embedded.Manifests var
    20  	err := manifest.InitGlobalManifests()
    21  	if err != nil {
    22  		fmt.Printf("Failed to initial manifests %v", err)
    23  		os.Exit(1)
    24  	}
    25  	defer manifest.CleanupManifests()
    26  
    27  	flags := pflag.NewFlagSet("psrctl", pflag.ExitOnError)
    28  	pflag.CommandLine = flags
    29  
    30  	rc := helpers.NewRootCmdContext(genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr})
    31  	rootCmd := root.NewRootCmd(rc)
    32  	if err := rootCmd.Execute(); err != nil {
    33  		os.Exit(1)
    34  	}
    35  }