command/fix: add synopsis option to fixers

This will be used in help output and such later
This commit is contained in:
Mitchell Hashimoto 2013-11-02 12:49:00 +04:00
parent 0f61db53e4
commit 49680548f4
4 changed files with 16 additions and 0 deletions

View File

@ -6,6 +6,10 @@ type Fixer interface {
// in some way, and returns the new, transformed structure. The
// Fix method is allowed to mutate the input.
Fix(input map[string]interface{}) (map[string]interface{}, error)
// Synopsis returns a string description of what the fixer actually
// does.
Synopsis() string
}
// Fixers is the map of all available fixers, by name.

View File

@ -49,3 +49,7 @@ func (FixerCreateTime) Fix(input map[string]interface{}) (map[string]interface{}
input["builders"] = tpl.Builders
return input, nil
}
func (FixerCreateTime) Synopsis() string {
return `Replaces ".CreateTime" in builder configs with "{{timestamp}}"`
}

View File

@ -41,3 +41,7 @@ func (FixerISOMD5) Fix(input map[string]interface{}) (map[string]interface{}, er
input["builders"] = tpl.Builders
return input, nil
}
func (FixerISOMD5) Synopsis() string {
return `Replaces "iso_md5" in builders with "iso_checksum"`
}

View File

@ -57,3 +57,7 @@ func (FixerVirtualBoxGAAttach) Fix(input map[string]interface{}) (map[string]int
input["builders"] = tpl.Builders
return input, nil
}
func (FixerVirtualBoxGAAttach) Synopsis() string {
return `Updates VirtualBox builders using "guest_additions_attach" to use "guest_additions_mode"`
}