init

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:    "init",
	Usage:   "Generates a .rain.yml file",
	Aliases: []string{"i"},
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "config",
			Value:   ".rain.yml",
			Aliases: []string{"c"},
			Usage:   "Load configuration from file",
		},
	},
	Action: func(c *cli.Context) error {
		var filename = c.String("config")
		f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC|os.O_EXCL, 0644)
		if err != nil {
			return err
		}
		defer f.Close()

		log.Infof(color.New(color.Bold).Sprintf("Generating %s file", filename))
		if _, err := f.WriteString(static.InitConfig); err != nil {
			return err
		}

		log.WithField("file", filename).Info("config created")
		return nil
	},
}

Command init

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