embed

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

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmbedCmd = &cobra.Command{
	Use:   "embed",
	Short: `Embed config file`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) <= 0 {
			logrus.Errorln("Please specify the config file path")
			os.Exit(1)
		}
		ok, err := checkEmbed()
		if err != nil {
			logrus.Errorln("check magic error", err)
			os.Exit(1)
		}

		if update && ok {
			err = updateEmbed(args[0], os.Args[0])
			if err != nil {
				logrus.Errorln(err)
				os.Exit(1)
			}
			logrus.Infoln("Update embed config file success")
			os.Exit(0)
		}

		if ok {
			logrus.Warnln("config file has been embedded")
			os.Exit(1)
		}
		copyBin, err := copyBin(os.Args[0])
		if err != nil {
			logrus.Errorln("create copy binary file error:", err.Error())
			os.Exit(1)
		}
		err = embed(args[0], copyBin)
		if err != nil {
			logrus.Errorln(err)
			os.Exit(1)
		}
		logrus.Infoln("Embed config file success")
	},
}

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