File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"syscall"
11
11
"time"
12
12
13
+ "github.com/monochromegane/terminal"
13
14
"github.com/rs/jplot/data"
14
15
"github.com/rs/jplot/graph"
15
16
"github.com/rs/jplot/osc"
@@ -44,15 +45,22 @@ func main() {
44
45
fatal ("screen and tmux not supported" )
45
46
}
46
47
48
+ if len (flag .Args ()) == 0 {
49
+ flag .Usage ()
50
+ os .Exit (1 )
51
+ }
52
+
47
53
specs , err := data .ParseSpec (flag .Args ())
48
54
if err != nil {
49
55
fatal ("Cannot parse spec: " , err )
50
56
}
51
57
var dp * data.Points
52
58
if * url != "" {
53
59
dp = data .FromHTTP (* url , * interval , * steps )
54
- } else {
60
+ } else if ! terminal . IsTerminal ( os . Stdin ) {
55
61
dp = data .FromStdin (* steps )
62
+ } else {
63
+ fatal ("neither --url nor stdin is provided" )
56
64
}
57
65
dash := graph.Dash {
58
66
Specs : specs ,
You can’t perform that action at this time.
0 commit comments