Skip to content

Commit e2c4328

Browse files
committed
add github reference to help version
1 parent ea69151 commit e2c4328

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package main
44

55
import "os"
66
import "fmt"
7-
import "path/filepath"
87
import "io"
98
import "net/http"
109
import "strconv"
@@ -16,7 +15,7 @@ import "github.com/gesquive/fast-cli/fast"
1615
import "github.com/gesquive/fast-cli/format"
1716
import "github.com/gesquive/fast-cli/meters"
1817

19-
var version = "v0.2.6"
18+
var version = "v0.2.7"
2019
var dirty = ""
2120
var displayVersion string
2221

@@ -34,8 +33,7 @@ var RootCmd = &cobra.Command{
3433
}
3534

3635
func main() {
37-
displayVersion = fmt.Sprintf("%s %s%s",
38-
filepath.Base(os.Args[0]),
36+
displayVersion = fmt.Sprintf("fast-cli %s%s",
3937
version,
4038
dirty)
4139
Execute(displayVersion)
@@ -45,6 +43,8 @@ func main() {
4543
// This is called by main.main(). It only needs to happen once to the rootCmd.
4644
func Execute(version string) {
4745
displayVersion = version
46+
RootCmd.SetHelpTemplate(fmt.Sprintf("%s\nVersion:\n github.com/gesquive/%s\n",
47+
RootCmd.HelpTemplate(), displayVersion))
4848
if err := RootCmd.Execute(); err != nil {
4949
fmt.Println(err)
5050
os.Exit(-1)

0 commit comments

Comments
 (0)