Documentation
¶
Overview ¶
Defines the cli-interface commands available to the user.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RootCmd = &cobra.Command{
Use: "",
Short: "Short desc",
Long: `Long description`,
}
RootCmd represents the base command when called without any subcommands.
var VersionCmd = &cobra.Command{ Use: "version", Short: "Get version", Long: `Get the current version of tool`, Run: func(cmd *cobra.Command, args []string) { fmt.Println(RootCmd.Use + "+ Version: " + version) info, ok := debug.ReadBuildInfo() if !ok { log.Fatal().Msg("could not read build info") } stamp := retrieveStamp(info) fmt.Printf(" Built with %s on %s\n", stamp.InfoGoCompiler, stamp.InfoBuildTime) fmt.Printf(" VCS revision: %s\n", stamp.VCSRevision) fmt.Printf(" Go version %s, GOOS %s, GOARCH %s\n", info.GoVersion, stamp.InfoGOOS, stamp.InfoGOARCH) fmt.Print(" Dependencies:\n") for _, mod := range retrieveDepends(info) { fmt.Printf(" %s\n", mod) } }, }
Print out versions of packages in use. Chore() - Updated manually.
Functions ¶
func Colorize ¶
Colorize function from zerolog console.go file to replicate their coloring functionality. Source: https://github.com/rs/zerolog/blob/a21d6107dcda23e36bc5cfd00ce8fdbe8f3ddc23/console.go#L389 Replicated here because it's a private function.
func ConfigureLogger ¶
func ConfigureLogger(debug bool)
func Execute ¶
func Execute(ver string)
Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func ProfilingFinalizer ¶
func ProfilingFinalizer()
Stop profiling and write cpu and memory profiling files if configured.
func SetupLogger ¶
Configure zerolog with some defaults and cleanup error formatting.
Types ¶
type CmdRootOptions ¶
type CmdRootOptions struct {
// log more information about what the tool is doing. Overrides --loglevel
Debug bool
// set log level
LogLevel string
// enable colorized output (default true). Set to false to disable")
Color bool
// Profiling output directory. Only captured if set.
ProfilingDir string
// CPU profiling output file handle.
ProfilingCPUFile *os.File
}
Default options that are available to all commands.
var RootConfig CmdRootOptions