File tree Expand file tree Collapse file tree 4 files changed +43
-2
lines changed Expand file tree Collapse file tree 4 files changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ builds:
1010 - darwin
1111 goarch :
1212 - amd64
13+ ldflags :
14+ - -s -w -X github.com/chriskim06/kubectl-topui/internal/cmd.tag={{.Version}}
1315archives :
1416- builds :
1517 - kubectl-topui
Original file line number Diff line number Diff line change 11build :
2- go build -o out/kubectl-topui
2+ go build -ldflags " -s -w -X github.com/chriskim06/kubectl-topui/internal/cmd.tag=DEV " - o out/kubectl-topui
33
44clean :
55 rm -r out
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ Keyboard Shortcuts:
2929 - q: quit
3030 - j: scroll down
3131 - k: scroll up
32- - ?: display help modal
3332 - enter: view spec for selected item`
3433)
3534
Original file line number Diff line number Diff line change 1+ /*
2+ Copyright © 2020 Chris Kim
3+
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ http://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+ */
16+ package cmd
17+
18+ import (
19+ "fmt"
20+
21+ "github.com/spf13/cobra"
22+ )
23+
24+ var (
25+ // set by goreleaser via ldflags
26+ tag string
27+
28+ versionCmd = & cobra.Command {
29+ Use : "version" ,
30+ Short : "Show topui version" ,
31+ RunE : func (_ * cobra.Command , args []string ) error {
32+ fmt .Printf ("v%s\n " , tag )
33+ return nil
34+ },
35+ }
36+ )
37+
38+ func init () {
39+ rootCmd .AddCommand (versionCmd )
40+ }
You can’t perform that action at this time.
0 commit comments