File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ builds:
1212 - windows
1313 goarch :
1414 - amd64
15+ ldflags :
16+ - -X "github.com/hashnode/hashnode-cli/cmd.version={{ .Version }}" -X "github.com/hashnode/hashnode-cli/cmd.commithash={{ .FullCommit }}"
17+
1518archive :
1619 name_template : " hashnode-{{ .Os }}-{{ .Arch }}"
1720 format_overrides :
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+ var version , commithash string
10+
11+ // versionCmd represents the version command
12+ var versionCmd = & cobra.Command {
13+ Use : "version" ,
14+ Short : "Print version number of hashnode" ,
15+ Run : func (cmd * cobra.Command , args []string ) {
16+ fmt .Printf ("Release: %s\n Commit: %s\n " , version , commithash )
17+ },
18+ }
19+
20+ func init () {
21+ rootCmd .AddCommand (versionCmd )
22+ }
You can’t perform that action at this time.
0 commit comments