Skip to content

Commit 1e16650

Browse files
authored
added version flag (fix: #25) (#26)
1 parent 8b562bf commit 1e16650

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ before_deploy:
3030
# they failed to build.
3131
- go get github.com/mitchellh/gox
3232
- mkdir releases
33-
- gox -osarch='!netbsd/arm !openbsd/386 !openbsd/amd64 !netbsd/386 !netbsd/amd64' -output="releases/{{.Dir}}_`git describe --tags --abbrev=0`_{{.OS}}_{{.Arch}}/{{.Dir}}"
33+
- gox -osarch='!netbsd/arm !openbsd/386 !openbsd/amd64 !netbsd/386 !netbsd/amd64' -output="releases/{{.Dir}}_`git describe --tags --abbrev=0`_{{.OS}}_{{.Arch}}/{{.Dir}}" -ldflags "-X main.Version=`git describe --tags --abbrev=0`"
3434
# Loop through the built architecture directories and create their corresponding tar.gz archives with the binary in it.
3535
- find releases -maxdepth 2 -mindepth 2 -type f -exec bash -c 'tar -cvzf "$(dirname {}).tar.gz" -C "$(dirname {})" $(basename {})' \;
3636

main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
package main
22

33
import (
4+
"flag"
5+
"fmt"
6+
"os"
7+
48
"github.com/docker/machine/libmachine/drivers/plugin"
59
)
610

11+
// Version will be added once we start the build process via travis-ci
12+
var Version string
13+
714
func main() {
15+
version := flag.Bool("v", false, "prints current docker-machine-driver-hetzner version")
16+
flag.Parse()
17+
if *version {
18+
fmt.Printf("Version: %s\n", Version)
19+
os.Exit(0)
20+
}
821
plugin.RegisterDriver(NewDriver())
922
}

0 commit comments

Comments
 (0)