Ejemplo n.º 1
0
Archivo: gotail.go Proyecto: 29n/tail
func args2config() tail.Config {
	config := tail.Config{Follow: true}
	flag.IntVar(&config.Location, "n", 0, "tail from the last Nth location")
	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.Parse()
	if config.ReOpen {
		config.Follow = true
	}
	return config
}
Ejemplo n.º 2
0
func args2config() (tail.Config, int64) {
	config := tail.Config{Follow: true}
	n := int64(0)
	flag.Int64Var(&n, "n", 0, "tail from the last Nth location")
	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")
	flag.Parse()
	if config.ReOpen {
		config.Follow = true
	}
	return config, n
}