cmd

package
v0.1.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// outJSON flag
	OutJSON   bool
	DebugMode bool
)
View Source
var RootCmd = &cobra.Command{
	Use:     "cld",
	Version: cliVersion,
	Short:   "A brief description of your application",
	Long: `This CLI has been created to add additional functionality
to https://docs.microsoft.com/en-us/cli/azure/ such as data
aggregation from multiple 'az' commands, reporting,
and pulling data from both Azure DevOps and Azure,
as well as other functionality.`,

	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {

		if DebugMode {
			fmt.Println("DEBUG MODE")

			f, err := os.Create("profile.prof")
			if err != nil {
				panic(err)
			}
			defer f.Close()

			if err := pprof.StartCPUProfile(f); err != nil {
				panic(err)
			}
			defer pprof.StopCPUProfile()

			memProfileFile, err := os.Create("mem.prof")
			if err != nil {
				panic(err)
			}
			defer memProfileFile.Close()

			if err := pprof.WriteHeapProfile(memProfileFile); err != nil {
				panic(err)
			}
			fmt.Println("Memory profile written to mem.prof")

			traceFile, err := os.Create("trace.out")
			if err != nil {
				panic(err)
			}
			defer traceFile.Close()

			if err := trace.Start(traceFile); err != nil {
				panic(err)
			}
			defer trace.Stop()
		}
		return InitializeConfig(cmd)
	},
}

rootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func InitializeConfig

func InitializeConfig(cmd *cobra.Command) error

Types

This section is empty.

Directories

Path Synopsis
datatransforms
From https://github.com/twpayne/go-jsonstruct
From https://github.com/twpayne/go-jsonstruct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳