init

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "Init",
	Short: "create clogrc/clog.yaml if missing",
	Long:  `create missing clogrc/clog.yaml and clogrc/tmp-core.clog.yaml.`,

	Run: func(cmd *cobra.Command, args []string) {
		sample := "tpl/clog.yaml"
		core := "core.clog.yaml"

		dstFolder := "clogrc"
		_, err := os.Stat(dstFolder)
		if err != nil {

			slog.Warn("creating folder " + dstFolder)
			if err = os.MkdirAll(dstFolder, 0755); err != nil {
				slog.Error("failed to create folder " + dstFolder)
				os.Exit(1)
			}
		}

		dst := dstFolder + "/clog.yaml"
		_, err = os.Stat(dst)
		if err != nil {

			copy.Command.Run(cmd, []string{sample, dst})
		}

		dst = "clogrc/tmp-core.clog.yaml"
		copy.Command.Run(cmd, []string{core, dst})
	},
}

Command define the cobra settings for this command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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