File tree Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 9
9
endif
10
10
endif
11
11
12
- TAG := "v1.0.1"
12
+ VERSION_FILE := cmd/version.go
13
+ TAG := $(shell sed -rn 's/const version = "(.* ) "/\1/p' $(VERSION_FILE ) )
13
14
OS_LIST := windows darwin linux
14
15
ARCH_LIST := 386 amd64 arm64
15
16
16
17
auto : $(TARGET )
17
18
19
+ test :
20
+ @echo $(TAG )
21
+
18
22
tidy :
19
23
@go mod tidy
20
24
73
77
@echo " clean: make clean clean bbx and bbx.exe file"
74
78
@echo " clean_all make clean_all clean all binary files"
75
79
@echo " install: make install install binary file to GOBIN dir"
76
- @echo " gen_releases: make gen_releases [TAG=v1.0.1] generate releases into releases/\$ $ TAG dir "
80
+ @echo " gen_releases: make gen_releases generate releases into releases/$( TAG) "
Original file line number Diff line number Diff line change
1
+ package cmd
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/spf13/cobra"
7
+ )
8
+
9
+ const version = "v1.0.2"
10
+
11
+ // versionCmd represents the version command
12
+ var versionCmd = & cobra.Command {
13
+ Use : "version" ,
14
+ Short : "A brief description of your command" ,
15
+ Long : `A longer description that spans multiple lines and likely contains examples
16
+ and usage of using your command. For example:
17
+
18
+ Cobra is a CLI library for Go that empowers applications.
19
+ This application is a tool to generate the needed files
20
+ to quickly create a Cobra application.` ,
21
+ Run : func (cmd * cobra.Command , args []string ) {
22
+ fmt .Println (version )
23
+ },
24
+ }
25
+
26
+ func init () {
27
+ rootCmd .AddCommand (versionCmd )
28
+
29
+ // Here you will define your flags and configuration settings.
30
+
31
+ // Cobra supports Persistent Flags which will work for this command
32
+ // and all subcommands, e.g.:
33
+ // versionCmd.PersistentFlags().String("foo", "", "A help for foo")
34
+
35
+ // Cobra supports local flags which will only run when this command
36
+ // is called directly, e.g.:
37
+ // versionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
38
+ }
You can’t perform that action at this time.
0 commit comments