@cryptotaxi247 / kubo / commits / d4e0ad97d

Vendor github.com/chriscool/go-sleep

License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Jun 6, 2015 at 23:07 UTC d4e0ad97dfec9e4c2bf9cdc0670845c738f10bbd
4 files changed +85
Godeps/Godeps.json
+4
@@ -276,6 +276,10 @@
276 {
277 "ImportPath": "gopkg.in/tomb.v1",
278 "Rev": "dd632973f1e7218eb1089048e0798ec9ae7dceb8"
279 + },
280 + {
281 + "ImportPath": "github.com/chriscool/go-sleep",
282 + "Rev": "743ab5f1bb487edf1772bc29ca0bdf572b40785e"
283 }
284 ]
285 }
Godeps/_workspace/src/github.com/chriscool/go-sleep/LICENSE new
+22
@@ -0,0 +1,22 @@
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2014 Juan Batiz-Benet
4 +Copyright (c) 2015 Christian Couder
5 +
6 +Permission is hereby granted, free of charge, to any person obtaining a copy
7 +of this software and associated documentation files (the "Software"), to deal
8 +in the Software without restriction, including without limitation the rights
9 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +copies of the Software, and to permit persons to whom the Software is
11 +furnished to do so, subject to the following conditions:
12 +
13 +The above copyright notice and this permission notice shall be included in
14 +all copies or substantial portions of the Software.
15 +
16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 +THE SOFTWARE.
Godeps/_workspace/src/github.com/chriscool/go-sleep/README.md new
+32
@@ -0,0 +1,32 @@
1 +# go-sleep sleeps for some duration
2 +
3 +This unix tool is a thin wrapper around `time.Sleep()`.
4 +It aims to provide a portable way to sleep for an amount of time that
5 +need not to be a number of seconds.
6 +
7 +See https://godoc.org/time#ParseDuration for how the duration can be
8 +specified.
9 +
10 +### Install
11 +
12 +```sh
13 +go install github.com/chriscool/go-sleep
14 +```
15 +
16 +### Usage:
17 +
18 +```
19 +> go-sleep
20 +Usage: go-sleep <duration>
21 +Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
22 +See https://godoc.org/time#ParseDuration for more.
23 +> time go-sleep 100ms
24 +
25 +real 0m0.104s
26 +user 0m0.000s
27 +sys 0m0.007s
28 +```
29 +
30 +### License
31 +
32 +MIT
Godeps/_workspace/src/github.com/chriscool/go-sleep/go-sleep.go new
+27
@@ -0,0 +1,27 @@
1 +package main
2 +
3 +import (
4 + "fmt"
5 + "os"
6 + "time"
7 +)
8 +
9 +func main() {
10 + if len(os.Args) != 2 {
11 + usageError()
12 + }
13 + d, err := time.ParseDuration(os.Args[1])
14 + if err != nil {
15 + fmt.Fprintf(os.Stderr, "Could not parse duration: %s\n", err)
16 + usageError()
17 + }
18 +
19 + time.Sleep(d)
20 +}
21 +
22 +func usageError() {
23 + fmt.Fprintf(os.Stderr, "Usage: %s <duration>\n", os.Args[0])
24 + fmt.Fprintln(os.Stderr, `Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`)
25 + fmt.Fprintln(os.Stderr, "See https://godoc.org/time#ParseDuration for more.")
26 + os.Exit(-1)
27 +}