File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
- "bufio"
5
4
"code.google.com/p/rsc/qr"
6
- "github.com/mattn/go-colorable "
5
+ "fmt "
7
6
"github.com/jessevdk/go-flags"
7
+ "github.com/mattn/go-colorable"
8
+ "io/ioutil"
8
9
"os"
9
10
10
11
"github.com/fumiyas/qrc/lib"
@@ -34,6 +35,11 @@ Text examples:
34
35
os .Stderr .Write ([]byte (v ))
35
36
}
36
37
38
+ func pErr (format string , a ... interface {}) {
39
+ fmt .Fprint (os .Stdout , os .Args [0 ], ": " )
40
+ fmt .Fprintf (os .Stdout , format , a ... )
41
+ }
42
+
37
43
func main () {
38
44
ret := 0
39
45
defer func () { os .Exit (ret ) }()
@@ -55,9 +61,12 @@ func main() {
55
61
if len (args ) == 1 {
56
62
text = args [0 ]
57
63
} else {
58
- // FIXME: Read all input
59
- rd := bufio .NewReaderSize (os .Stdin , 1024 )
60
- text_bytes , _ , _ := rd .ReadLine ()
64
+ text_bytes , err := ioutil .ReadAll (os .Stdin )
65
+ if err != nil {
66
+ pErr ("read from stdin failed: %v\n " , err )
67
+ ret = 1
68
+ return
69
+ }
61
70
text = string (text_bytes )
62
71
}
63
72
You can’t perform that action at this time.
0 commit comments