File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 11project_name : pcert
22builds :
33- main : ./cmd/pcert/
4+ ldflags :
5+ - -s -w
6+ - -X main.version={{.Version}}
7+ - -X main.commit={{.Commit}}
48 goos :
59 - linux
610 - darwin
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ const (
2020 csrFileSuffix = ".csr"
2121)
2222
23+ var (
24+ version = "n/a"
25+ commit = "n/a"
26+ )
27+
2328type app struct {
2429 // signer settings
2530 signCertFile string
@@ -192,10 +197,22 @@ prefix (e.g PCERT_CERT instad of --cert).`,
192197 newSignCmd (cfg ),
193198 newListCmd (),
194199 newCompletionCmd (),
200+ newVersionCmd (),
195201 )
196202 return cmd
197203}
198204
205+ func newVersionCmd () * cobra.Command {
206+ cmd := & cobra.Command {
207+ Use : "version" ,
208+ RunE : func (cmd * cobra.Command , args []string ) error {
209+ fmt .Println ("pcert" , version , commit )
210+ return nil
211+ },
212+ }
213+ return cmd
214+ }
215+
199216func newCompletionCmd () * cobra.Command {
200217 var shell string
201218 cmd := & cobra.Command {
You can’t perform that action at this time.
0 commit comments