Commit 977969a7 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

command/inspect: cleaner output if no required vars

parent 0b975b92
......@@ -48,15 +48,23 @@ func (c Command) Run(env packer.Environment, args []string) int {
ui.Say("Variables:\n")
ui.Say(" <No variables>")
} else {
ui.Say("Required variables:\n")
requiredHeader := false
for k, v := range tpl.Variables {
if v.Required {
if !requiredHeader {
requiredHeader = true
ui.Say("Required variables:\n")
}
ui.Machine("template-variable", k, v.Default, "1")
ui.Say(" " + k)
}
}
ui.Say("")
if requiredHeader {
ui.Say("")
}
ui.Say("Optional variables and their defaults:\n")
keys := make([]string, 0, len(tpl.Variables))
max := 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment