Implement the show command (#53)
This commit is contained in:
parent
b9b555ba68
commit
f425d3f007
14 changed files with 231 additions and 55 deletions
|
|
@ -2,6 +2,7 @@ package util
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
|
|
@ -112,3 +113,18 @@ func WrapString(s string, lim uint) string {
|
|||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
|
||||
// ReadLine will read a single line from a bufio.Reader
|
||||
func ReadLine(r *bufio.Reader) (string, error) {
|
||||
var (
|
||||
isPrefix bool
|
||||
err error
|
||||
line, ln []byte
|
||||
)
|
||||
for isPrefix && err == nil {
|
||||
line, isPrefix, err = r.ReadLine()
|
||||
ln = append(ln, line...)
|
||||
}
|
||||
return string(ln), err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue