File tree Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Original file line number Diff line number Diff line change 77 "io"
88 "io/ioutil"
99 "net/http"
10+ "net/http/httptrace"
1011 "os"
1112 "regexp"
1213 "strconv"
@@ -114,10 +115,6 @@ func main() {
114115 }
115116
116117 if * uploadEndpoint != "" {
117- if * verbose {
118- fmt .Println ("Uploading the sketch" )
119- }
120-
121118 f , err := os .Open (* sketchPath )
122119 if err != nil {
123120 if * verbose {
@@ -156,6 +153,32 @@ func main() {
156153 req .SetBasicAuth (* username , * password )
157154 }
158155
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+
159182 resp , err := httpClient .Do (req )
160183 if err != nil {
161184 if * verbose {
You can’t perform that action at this time.
0 commit comments