forked from tordarus/format
show version
This commit is contained in:
9
main.go
9
main.go
@ -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)
|
||||
|
Reference in New Issue
Block a user