From b6a8901ebbc629eb1a31027311921da418030df6 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 28 Jul 2018 13:08:18 +0800 Subject: [PATCH] fix: add syntax only flag --- main.go | 18 ++++++++++++------ plugin.go | 1 - 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 8fe95f1..5f359b5 100644 --- a/main.go +++ b/main.go @@ -50,6 +50,11 @@ func main() { Usage: "Will execute multiple builds in parallel as defined in the template", EnvVar: "PLUGIN_TEMPLATE", }, + cli.BoolFlag{ + Name: "syntax_only", + Usage: "Only check syntax. Do not verify config of the template", + EnvVar: "PLUGIN_SYNTAX_ONLY", + }, } app.Version = Version @@ -83,12 +88,13 @@ func run(c *cli.Context) error { plugin := Plugin{ Config: Config{ - Actions: c.StringSlice("actions"), - Vars: vars, - Template: c.String("template"), - VarFiles: c.StringSlice("var_files"), - Except: c.StringSlice("except"), - Only: c.StringSlice("only"), + Actions: c.StringSlice("actions"), + Vars: vars, + Template: c.String("template"), + VarFiles: c.StringSlice("var_files"), + Except: c.StringSlice("except"), + Only: c.StringSlice("only"), + SyntaxOnly: c.Bool("syntax_only"), }, } diff --git a/plugin.go b/plugin.go index 88e1844..16cb663 100644 --- a/plugin.go +++ b/plugin.go @@ -74,7 +74,6 @@ func (p *Plugin) Exec() error { commands = append(commands, exec.Command("packer", "version")) - logrus.Println(p.Config.Actions) // Add commands listed from Actions for _, action := range p.Config.Actions { switch action {