Skip to content

Commit e77f738

Browse files
committed
update how version info is saved & displayed
1 parent 7c2e1d7 commit e77f738

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

cmd/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ var RootCmd = &cobra.Command{
3535
// This is called by main.main(). It only needs to happen once to the rootCmd.
3636
func Execute(version string) {
3737
displayVersion = version
38+
RootCmd.SetHelpTemplate(fmt.Sprintf("%s\nVersion:\n github.com/gesquive/%s\n",
39+
RootCmd.HelpTemplate(), displayVersion))
3840
if err := RootCmd.Execute(); err != nil {
3941
fmt.Println(err)
4042
os.Exit(-1)

main.go

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

3-
import "os"
43
import "fmt"
5-
import "path/filepath"
64
import "github.com/gesquive/git-user/cmd"
75

8-
var version = "v2.0.3"
6+
var version = "v2.0.4"
97
var dirty = ""
108

119
func main() {
12-
displayVersion := fmt.Sprintf("%s %s%s",
13-
filepath.Base(os.Args[0]),
10+
displayVersion := fmt.Sprintf("git-user %s%s",
1411
version,
1512
dirty)
1613
cmd.Execute(displayVersion)

0 commit comments

Comments
 (0)