add -max param to gotail utility

This commit is contained in:
Sridhar Ratnakumar 2014-05-16 18:10:04 -07:00
parent 136cda4961
commit 4441c2eb1b
2 changed files with 5 additions and 2 deletions

View File

@ -12,7 +12,9 @@ import (
func args2config() (tail.Config, int64) {
config := tail.Config{Follow: true}
n := int64(0)
maxlinesize := int(0)
flag.Int64Var(&n, "n", 0, "tail from the last Nth location")
flag.IntVar(&maxlinesize, "max", 0, "max line size")
flag.BoolVar(&config.Follow, "f", false, "wait for additional data to be appended to the file")
flag.BoolVar(&config.ReOpen, "F", false, "follow, and track file rename/rotation")
flag.BoolVar(&config.Poll, "p", false, "use polling, instead of inotify")
@ -20,6 +22,7 @@ func args2config() (tail.Config, int64) {
if config.ReOpen {
config.Follow = true
}
config.MaxLineSize = maxlinesize
return config, n
}