packer-cn/packer/version.go

39 lines
864 B
Go
Raw Normal View History

package packer
import (
"bytes"
"fmt"
)
// The version of packer.
const Version = "0.1.0"
// 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.
const VersionPrerelease = "dev"
type versionCommand byte
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 {
var versionString bytes.Buffer
fmt.Fprintf(&versionString, "Packer v%s", Version)
if VersionPrerelease != "" {
fmt.Fprintf(&versionString, ".%s", VersionPrerelease)
}
env.Ui().Say(versionString.String())
return 0
}
2013-03-24 19:28:35 -04:00
func (versionCommand) Synopsis() string {
return "print Packer version"
}