package util import ( "flag" "os" "strings" "git.mstar.dev/mstar/goutils/sliceutils" ) func LoadFileFromArgs() []byte { if !flag.Parsed() { flag.Parse() } data, err := os.ReadFile(flag.CommandLine.Arg(0)) if err != nil { panic(err) } return data } func AbsI(a int) int { if a > 0 { return a } else { return -a } } func FileContentToNonEmptyLines(data []byte) []string { return sliceutils.Filter( strings.Split(string(data), "\n"), func(t string) bool { return len(t) > 0 }, ) }