cmd

package
v0.0.0-...-2c9d471 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "gocli",
	Short: "CLI helper scripts for various things",
	Long: `CLI helper scripts for various things.
	An approach to replace bash scripting with Golang`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		var err error
		cfg := zap.NewProductionConfig()
		if Args.Debug {
			cfg.Level.SetLevel(zap.DebugLevel)
		}

		cfg.OutputPaths = []string{"stdout"}
		cfg.Encoding = "console"
		cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
		Args.Logger, err = cfg.Build()
		if err != nil {
			fmt.Fprintf(os.Stderr, "Failed to setup logger: %s\n", err)
			os.Exit(1)
		}
	},
}

Functions

func Execute

func Execute()

Types

type RootArgs

type RootArgs struct {
	Debug  bool
	Logger *zap.Logger
}
var Args RootArgs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL