File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 1
1
package facade
2
2
3
3
import (
4
- "bytes"
5
4
"fmt"
6
5
"io"
7
6
"os"
@@ -68,7 +67,7 @@ var rootCmd = &cobra.Command{
68
67
} else if tomlFlag {
69
68
result , err = info .TOML ()
70
69
} else {
71
- result = bytes . NewBufferString ( info .String () )
70
+ result = info .ToString ( " \t " )
72
71
err = nil
73
72
}
74
73
if err != nil {
Original file line number Diff line number Diff line change @@ -60,19 +60,24 @@ func (i *Info) JSON() (io.Reader, error) {
60
60
return buf , nil
61
61
}
62
62
63
- //Stringer as TOML format
64
- func (i * Info ) String () string {
63
+ //ToString returns string buffer
64
+ func (i * Info ) ToString (indent string ) * bytes.Buffer {
65
+ buf := new (bytes.Buffer )
65
66
if i == nil {
66
- return ""
67
+ return buf
67
68
}
68
69
if len (i .Packets ) == 0 {
69
- return ""
70
+ return buf
70
71
}
71
- buf := new (bytes.Buffer )
72
72
for _ , itm := range i .Packets {
73
- itm .toString (" \t " , 0 , buf )
73
+ itm .toString (indent , 0 , buf )
74
74
}
75
- return buf .String ()
75
+ return buf
76
+ }
77
+
78
+ //Stringer as TOML format
79
+ func (i * Info ) String () string {
80
+ return i .ToString ("\t " ).String ()
76
81
}
77
82
78
83
//Item is information item class
You can’t perform that action at this time.
0 commit comments