add small subcommand to validate config

This commit is contained in:
Christian Schwarz 2018-09-05 08:32:38 -07:00
parent 4b39a18178
commit 6c988d0ebb
2 changed files with 21 additions and 0 deletions

8
client/configcheck.go Normal file
View File

@ -0,0 +1,8 @@
package client
import "github.com/zrepl/zrepl/config"
func RunConfigcheck(conf *config.Config, args []string) error {
// TODO: do the 'build' steps, e.g. build the jobs and see if that fails
return nil
}

13
main.go
View File

@ -88,6 +88,18 @@ var bashcompCmd = &cobra.Command{
Hidden: true,
}
var configcheckCmd = &cobra.Command{
Use: "configcheck",
Short: "validate config file",
RunE: func(cmd *cobra.Command, args []string) error {
conf, err := config.ParseConfig(rootArgs.configFile)
if err != nil {
return err
}
return client.RunConfigcheck(conf, args)
},
}
var rootArgs struct {
configFile string
}
@ -100,6 +112,7 @@ func init() {
rootCmd.AddCommand(statusCmd)
rootCmd.AddCommand(stdinserverCmd)
rootCmd.AddCommand(bashcompCmd)
rootCmd.AddCommand(configcheckCmd)
}
func main() {