This is an education project that attempts to reimplement the GNU coreutils in Go. You can find the full manual here: https://www.gnu.org/software/coreutils/manual/coreutils.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
405 B

package main
import (
"fmt"
"time"
"flag"
"log"
)
func main() {
wait_for := "1s"
message := "test"
flag.StringVar(&wait_for, "d", "1s", "go time duration to parse")
flag.Parse()
if flag.NArg() > 0 {
message = flag.Args()[0]
}
for {
to_wait, err := time.ParseDuration(wait_for)
if err != nil { log.Fatal(err) }
time.Sleep(to_wait)
fmt.Println(message)
}
}