mirror of
https://github.com/jimeh/go-golden.git
synced 2026-02-19 11:16:47 +00:00
wip: unfinished further tweaks
This commit is contained in:
20
update.go
20
update.go
@@ -1,6 +1,7 @@
|
||||
package golden
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
@@ -24,3 +25,22 @@ func EnvUpdateFunc() bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
updateFlagSet *flag.FlagSet
|
||||
updateFlag bool
|
||||
)
|
||||
|
||||
// UpdateFunc returns a function that checks a -update flag is set.
|
||||
func FlagUpdateFunc() bool {
|
||||
if updateFlagSet == nil {
|
||||
updateFlagSet = flag.NewFlagSet("golden", flag.ContinueOnError)
|
||||
updateFlagSet.BoolVar(&updateFlag,
|
||||
"update", false, "update golden files",
|
||||
)
|
||||
}
|
||||
|
||||
_ = updateFlagSet.Parse(os.Args[1:])
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user