Files
talos/internal/app/osinstall/cmd/validate.go
Andrew Rynhard e18b5086a9 chore: update org to new name (#480)
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2019-04-03 18:29:21 -07:00

33 lines
830 B
Go

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// nolint: dupl,golint
package cmd
import (
"log"
"github.com/spf13/cobra"
"github.com/talos-systems/talos/internal/app/osinstall/internal/userdata"
)
// validateCmd reads in a userData file and attempts to parse it
var validateCmd = &cobra.Command{
Use: "validate",
Short: "Validate userdata",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
ud, err := userdata.UserData(userdataFile)
if err != nil {
log.Fatal(err)
}
log.Println(ud)
},
}
func init() {
validateCmd.Flags().StringVarP(&userdataFile, "userdata", "u", "", "path or url of userdata file")
rootCmd.AddCommand(validateCmd)
}