mirror of
https://github.com/EricNeid/go-sleep.git
synced 2025-01-10 17:45:07 +00:00
Implemented simple sleep
This commit is contained in:
parent
5bce145ee6
commit
f195167756
@ -1,5 +1,21 @@
|
||||
package main
|
||||
|
||||
import "os"
|
||||
import "strconv"
|
||||
import "fmt"
|
||||
import "time"
|
||||
|
||||
func main() {
|
||||
// TODO
|
||||
sleep := 1
|
||||
if len(os.Args) > 1 {
|
||||
var err error
|
||||
sleep, err = strconv.Atoi(os.Args[1])
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("Given %s is not a valid sleep time\n", os.Args[1])
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(time.Duration(sleep) * time.Second)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user