File tree 1 file changed +27
-4
lines changed
1 file changed +27
-4
lines changed Original file line number Diff line number Diff line change 7
7
"io"
8
8
"io/ioutil"
9
9
"net/http"
10
+ "net/http/httptrace"
10
11
"os"
11
12
"regexp"
12
13
"strconv"
@@ -114,10 +115,6 @@ func main() {
114
115
}
115
116
116
117
if * uploadEndpoint != "" {
117
- if * verbose {
118
- fmt .Println ("Uploading the sketch" )
119
- }
120
-
121
118
f , err := os .Open (* sketchPath )
122
119
if err != nil {
123
120
if * verbose {
@@ -156,6 +153,32 @@ func main() {
156
153
req .SetBasicAuth (* username , * password )
157
154
}
158
155
156
+ if * verbose {
157
+ trace := & httptrace.ClientTrace {
158
+ ConnectStart : func (network , addr string ) {
159
+ fmt .Print ("Connecting to board ... " )
160
+ },
161
+ ConnectDone : func (network , addr string , err error ) {
162
+ if err != nil {
163
+ fmt .Println ("failed!" )
164
+ } else {
165
+ fmt .Println (" done" )
166
+ }
167
+ },
168
+ WroteHeaders : func () {
169
+ fmt .Print ("Uploading sketch ... " )
170
+ },
171
+ WroteRequest : func (wri httptrace.WroteRequestInfo ) {
172
+ fmt .Println (" done" )
173
+ fmt .Print ("Flashing sketch ... " )
174
+ },
175
+ GotFirstResponseByte : func () {
176
+ fmt .Println (" done" )
177
+ },
178
+ }
179
+ req = req .WithContext (httptrace .WithClientTrace (req .Context (), trace ))
180
+ }
181
+
159
182
resp , err := httpClient .Do (req )
160
183
if err != nil {
161
184
if * verbose {
You can’t perform that action at this time.
0 commit comments