diff --git a/coreos-cloudinit.go b/coreos-cloudinit.go index 7499383..bbaf36e 100644 --- a/coreos-cloudinit.go +++ b/coreos-cloudinit.go @@ -1,17 +1,24 @@ package main import ( + "fmt" "flag" "io/ioutil" + "os" "log" "github.com/coreos/coreos-cloudinit/cloudinit" ) +const version = "0.1.0+git" + func main() { var userdata []byte var err error + var printVersion bool + flag.BoolVar(&printVersion, "version", false, "Print the version and exit") + var file string flag.StringVar(&file, "from-file", "", "Read user-data from file rather than metadata service") @@ -20,6 +27,11 @@ func main() { flag.Parse() + if printVersion == true { + fmt.Printf("coreos-cloudinit version %s\n", version) + os.Exit(0) + } + if file != "" { log.Printf("Reading user-data from file: %s", file) userdata, err = ioutil.ReadFile(file)