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