show version

This commit is contained in:
Timon Ringwald
2022-08-29 13:45:28 +02:00
parent 75dce36679
commit e7a2a65eb6
3 changed files with 16 additions and 1 deletions

View File

@ -10,6 +10,8 @@ import (
"strconv"
"strings"
"unicode/utf8"
"git.milar.in/milarin/buildinfo"
)
var (
@ -45,6 +47,8 @@ var (
// it may be useful to have a boolean flag for this behavior
lineParseAmount = flag.Int("n", 1, "amount of lines to feed into input pattern")
showVersion = flag.Bool("v", false, "show version and exit")
replacePattern = regexp.MustCompile(`\{(\d+)(?::(.*?))?(?::(.*?))?(?::(.*?))?\}`)
numMutationPattern = regexp.MustCompile(`([+\-*/])(\d+|\((\d+)\))`)
)
@ -52,6 +56,11 @@ var (
func main() {
flag.Parse()
if *showVersion {
buildinfo.Print(buildinfo.Options{})
return
}
pattern, err := regexp.Compile(*input)
if err != nil {
panic(err)