mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 01:12:24 +08:00
Vendor github.com/chriscool/go-sleep
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
4
Godeps/Godeps.json
generated
4
Godeps/Godeps.json
generated
@ -276,6 +276,10 @@
|
||||
{
|
||||
"ImportPath": "gopkg.in/tomb.v1",
|
||||
"Rev": "dd632973f1e7218eb1089048e0798ec9ae7dceb8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/chriscool/go-sleep",
|
||||
"Rev": "743ab5f1bb487edf1772bc29ca0bdf572b40785e"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
22
Godeps/_workspace/src/github.com/chriscool/go-sleep/LICENSE
generated
vendored
Normal file
22
Godeps/_workspace/src/github.com/chriscool/go-sleep/LICENSE
generated
vendored
Normal file
@ -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.
|
32
Godeps/_workspace/src/github.com/chriscool/go-sleep/README.md
generated
vendored
Normal file
32
Godeps/_workspace/src/github.com/chriscool/go-sleep/README.md
generated
vendored
Normal file
@ -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 <duration>
|
||||
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
|
27
Godeps/_workspace/src/github.com/chriscool/go-sleep/go-sleep.go
generated
vendored
Normal file
27
Godeps/_workspace/src/github.com/chriscool/go-sleep/go-sleep.go
generated
vendored
Normal file
@ -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 <duration>\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)
|
||||
}
|
Reference in New Issue
Block a user