PKGBUILD/cmd/config/create.go

29 lines
636 B
Go

package config
import (
"log"
"git.cryptic.systems/fh-trier/go-flucky/pkg/config"
"github.com/spf13/cobra"
)
var force bool
var logDir string
var createConfigCmd = &cobra.Command{
Use: "create",
Short: "create",
Run: func(cmd *cobra.Command, args []string) {
if err := config.Create(configDir, logDir, force); err != nil {
log.Fatal(err)
}
},
}
func init() {
configCmd.AddCommand(createConfigCmd)
createConfigCmd.Flags().BoolVarP(&force, "force", "f", false, "Force the creation of a new configuration")
createConfigCmd.Flags().StringVarP(&logDir, "log-dir", "l", "/var/log/flucky", "Directory for logfiles")
}