Flag version, bumped to v2

This commit is contained in:
Magnus Åhall 2024-04-23 20:21:08 +02:00
parent f523c6eaf0
commit 0bfcd7a8a9
2 changed files with 8 additions and 1 deletions

View File

@ -19,17 +19,24 @@ func (i *arrayFlags) Set(value string) error {
} }
var ( var (
flagVersion bool
flagIncludeAll bool flagIncludeAll bool
flagExcludeAll bool flagExcludeAll bool
flagExcept arrayFlags flagExcept arrayFlags
) )
func init() { func init() {
flag.BoolVar(&flagVersion, "version", false, "Prints version and exits.")
flag.BoolVar(&flagIncludeAll, "include-all", false, "Split out all databases, with provided exceptions.") flag.BoolVar(&flagIncludeAll, "include-all", false, "Split out all databases, with provided exceptions.")
flag.BoolVar(&flagExcludeAll, "exclude-all", false, "Split out no databases, with provided exceptions.") flag.BoolVar(&flagExcludeAll, "exclude-all", false, "Split out no databases, with provided exceptions.")
flag.Var(&flagExcept, "except", "Exception to rule, can be used multiple times") flag.Var(&flagExcept, "except", "Exception to rule, can be used multiple times")
flag.Parse() flag.Parse()
if flagVersion {
fmt.Println(VERSION)
os.Exit(0)
}
if flagIncludeAll && flagExcludeAll { if flagIncludeAll && flagExcludeAll {
fmt.Println("-include-all and -exclude-all are mutually exclusive") fmt.Println("-include-all and -exclude-all are mutually exclusive")
os.Exit(1) os.Exit(1)

View File

@ -9,7 +9,7 @@ import (
"slices" "slices"
) )
const VERSION = "v1" const VERSION = "v2"
const MAXLINE = 1048576 const MAXLINE = 1048576
type Db struct { type Db struct {