mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Add --version option
* Add flag to display the version for each binary. It is based on `git describe` but adds a number to the PATCH level if we are between annotated tags, so makes it semver.org compatible. Use the "-ldflags" method that also works with go 1.17. * Use Makefile bash and sed magic to do PATCH level increase if needed. Co-authored-by: Bernhard Reiter <bernhard@intevation.de>
This commit is contained in:
parent
de9c2b9663
commit
6fe6907c1d
5 changed files with 57 additions and 6 deletions
|
|
@ -23,6 +23,7 @@ import (
|
|||
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
"github.com/csaf-poc/csaf_distribution/csaf"
|
||||
"github.com/csaf-poc/csaf_distribution/util"
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
|
@ -48,7 +49,8 @@ type options struct {
|
|||
|
||||
Insecure bool `long:"insecure" description:"Do not check TLS certificates from provider"`
|
||||
|
||||
Config *string `short:"c" long:"config" description:"Path to config ini file" value-name:"INI-FILE" no-ini:"true"`
|
||||
Config *string `short:"c" long:"config" description:"Path to config ini file" value-name:"INI-FILE" no-ini:"true"`
|
||||
Version bool `long:"version" description:"Display version of the binary"`
|
||||
}
|
||||
|
||||
type processor struct {
|
||||
|
|
@ -359,6 +361,11 @@ func main() {
|
|||
args, err := parser.Parse()
|
||||
check(err)
|
||||
|
||||
if opts.Version {
|
||||
fmt.Println(util.SemVersion)
|
||||
return
|
||||
}
|
||||
|
||||
if opts.Config != nil {
|
||||
iniParser := flags.NewIniParser(parser)
|
||||
iniParser.ParseAsDefaults = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue