Skip to content

Commit 88ee83d

Browse files
committed
add version command and always display it in help - Issue #25
1 parent 8b30765 commit 88ee83d

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = 0.14
1+
VERSION = 0.15
22
GO_FMT = gofmt -s -w -l .
33
GO_XC = goxc -os="linux" -tasks-="rmbin"
44

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ The method below will install the sysvinit and /etc/default options that can be
3636
1. Install the Package
3737

3838
```
39-
$ wget https://github.com/gondor/docker-volume-netshare/releases/download/v0.14/docker-volume-netshare_0.14_amd64.deb
40-
$ sudo dpkg -i docker-volume-netshare_0.14_amd64.deb
39+
$ wget https://github.com/gondor/docker-volume-netshare/releases/download/v0.15/docker-volume-netshare_0.15_amd64.deb
40+
$ sudo dpkg -i docker-volume-netshare_0.15_amd64.deb
4141
```
4242

4343
2. Modify the startup options in `/etc/default/docker-volume-netshare`

main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import (
44
"github.com/gondor/docker-volume-netshare/netshare"
55
)
66

7+
var VERSION string = ""
8+
var BUILD_DATE string = ""
9+
710
func main() {
11+
netshare.Version = VERSION
12+
netshare.BuildDate = BUILD_DATE
813
netshare.Execute()
914
}

netshare/netshare.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const (
3939
4040
Provides docker volume support for NFS v3 and 4, EFS as well as CIFS. This plugin can be run multiple times to
4141
support different mount types.
42+
43+
== Version: %s - Built: %s ==
4244
`
4345
)
4446

@@ -67,12 +69,23 @@ var (
6769
Short: "run plugin in AWS EFS mode",
6870
Run: execEFS,
6971
}
72+
73+
versionCmd = &cobra.Command{
74+
Use: "version",
75+
Short: "Display current version and build date",
76+
Run: func(cmd *cobra.Command, args []string) {
77+
fmt.Printf("\nVersion: %s - Built: %s\n\n", Version, BuildDate)
78+
},
79+
}
7080
baseDir = ""
81+
Version string = ""
82+
BuildDate string = ""
7183
)
7284

7385
func Execute() {
7486
setupFlags()
75-
rootCmd.AddCommand(cifsCmd, nfsCmd, efsCmd)
87+
rootCmd.Long = fmt.Sprintf(NetshareHelp, Version, BuildDate)
88+
rootCmd.AddCommand(versionCmd, cifsCmd, nfsCmd, efsCmd)
7689
rootCmd.Execute()
7790
}
7891

0 commit comments

Comments
 (0)