Made sleeper configurable

drew/sql-it
Drew Bednar 7 months ago
parent aa7df72415
commit 6e434e487d

Binary file not shown.

@ -1,6 +1,7 @@
package main
import (
"flag"
"fmt"
"io"
"os"
@ -40,6 +41,10 @@ func Countdown(out io.Writer, sleeper Sleeper, count int) {
}
func main() {
sleeper := &ConfigurableSleeper{1 * time.Second, time.Sleep}
Countdown(os.Stdout, sleeper, 3)
count := flag.Int("count", 3, "Countdown start number")
seconds := flag.Float64("seconds", 1, "Number of sleep seconds between count calls")
flag.Parse()
sleeper := &ConfigurableSleeper{time.Duration(*seconds * float64(time.Second)), time.Sleep}
Countdown(os.Stdout, sleeper, *count)
}

Loading…
Cancel
Save