@@ -9,13 +9,13 @@ import (
9
9
"github.com/codegangsta/cli"
10
10
)
11
11
12
- func formatUserAgentRule (rule cloudflare.UserAgentRule ) table {
13
- return table {
14
- "ID" : rule .ID ,
15
- "Description" : rule .Description ,
16
- "Mode" : rule .Mode ,
17
- "Value" : rule .Configuration .Value ,
18
- "Paused" : strconv .FormatBool (rule .Paused ),
12
+ func formatUserAgentRule (rule cloudflare.UserAgentRule ) [] string {
13
+ return [] string {
14
+ rule .ID ,
15
+ rule .Description ,
16
+ rule .Mode ,
17
+ rule .Configuration .Value ,
18
+ strconv .FormatBool (rule .Paused ),
19
19
}
20
20
}
21
21
@@ -52,11 +52,11 @@ func userAgentCreate(c *cli.Context) {
52
52
return
53
53
}
54
54
55
- output := []table {
55
+ output := [][] string {
56
56
formatUserAgentRule (resp .Result ),
57
57
}
58
58
59
- makeTable (output , "ID" , "Description" , "Mode" , "Value" , "Paused" )
59
+ writeTable (output , "ID" , "Description" , "Mode" , "Value" , "Paused" )
60
60
}
61
61
62
62
func userAgentUpdate (c * cli.Context ) {
@@ -91,11 +91,11 @@ func userAgentUpdate(c *cli.Context) {
91
91
return
92
92
}
93
93
94
- output := []table {
94
+ output := [][] string {
95
95
formatUserAgentRule (resp .Result ),
96
96
}
97
97
98
- makeTable (output , "ID" , "Description" , "Mode" , "Value" , "Paused" )
98
+ writeTable (output , "ID" , "Description" , "Mode" , "Value" , "Paused" )
99
99
}
100
100
101
101
func userAgentDelete (c * cli.Context ) {
@@ -120,11 +120,11 @@ func userAgentDelete(c *cli.Context) {
120
120
return
121
121
}
122
122
123
- output := []table {
123
+ output := [][] string {
124
124
formatUserAgentRule (resp .Result ),
125
125
}
126
126
127
- makeTable (output , "ID" , "Description" , "Mode" , "Value" , "Paused" )
127
+ writeTable (output , "ID" , "Description" , "Mode" , "Value" , "Paused" )
128
128
}
129
129
130
130
func userAgentList (c * cli.Context ) {
@@ -149,10 +149,10 @@ func userAgentList(c *cli.Context) {
149
149
return
150
150
}
151
151
152
- output := make ([]table , 0 , len (resp .Result ))
152
+ output := make ([][] string , 0 , len (resp .Result ))
153
153
for _ , rule := range resp .Result {
154
154
output = append (output , formatUserAgentRule (rule ))
155
155
}
156
156
157
- makeTable (output , "ID" , "Description" , "Mode" , "Value" , "Paused" )
157
+ writeTable (output , "ID" , "Description" , "Mode" , "Value" , "Paused" )
158
158
}
0 commit comments