2013-03-24 17:03:53 -04:00
|
|
|
package packer
|
|
|
|
|
2013-06-20 01:20:52 -04:00
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"fmt"
|
|
|
|
)
|
2013-05-27 18:12:48 -04:00
|
|
|
|
2013-03-24 17:03:53 -04:00
|
|
|
// The version of packer.
|
2013-07-03 14:06:30 -04:00
|
|
|
const Version = "0.1.5"
|
2013-06-20 01:20:52 -04:00
|
|
|
|
|
|
|
// Any pre-release marker for the version. If this is "" (empty string),
|
|
|
|
// then it means that it is a final release. Otherwise, this is the
|
|
|
|
// pre-release marker.
|
2013-07-03 14:06:30 -04:00
|
|
|
const VersionPrerelease = "dev"
|
2013-03-24 17:03:53 -04:00
|
|
|
|
|
|
|
type versionCommand byte
|
|
|
|
|
2013-06-02 14:41:12 -04:00
|
|
|
func (versionCommand) Help() string {
|
|
|
|
return `usage: packer version
|
|
|
|
|
|
|
|
Outputs the version of Packer that is running. There are no additional
|
|
|
|
command-line flags for this command.`
|
|
|
|
}
|
|
|
|
|
2013-05-02 17:03:55 -04:00
|
|
|
func (versionCommand) Run(env Environment, args []string) int {
|
2013-06-20 01:20:52 -04:00
|
|
|
var versionString bytes.Buffer
|
|
|
|
fmt.Fprintf(&versionString, "Packer v%s", Version)
|
|
|
|
if VersionPrerelease != "" {
|
|
|
|
fmt.Fprintf(&versionString, ".%s", VersionPrerelease)
|
|
|
|
}
|
|
|
|
|
|
|
|
env.Ui().Say(versionString.String())
|
2013-03-24 17:03:53 -04:00
|
|
|
return 0
|
|
|
|
}
|
2013-03-24 19:28:35 -04:00
|
|
|
|
|
|
|
func (versionCommand) Synopsis() string {
|
|
|
|
return "print Packer version"
|
|
|
|
}
|