| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package cli | 5 package cli |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bufio" | 8 "bufio" |
| 9 "encoding/json" | 9 "encoding/json" |
| 10 "io" | 10 "io" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 // User-friendly: trim any leading or trailing slashes from the path. | 71 // User-friendly: trim any leading or trailing slashes from the path. |
| 72 project, path, unified, err := a.splitPath(cmd.path) | 72 project, path, unified, err := a.splitPath(cmd.path) |
| 73 if err != nil { | 73 if err != nil { |
| 74 log.WithError(err).Errorf(a, "Invalid path specifier.") | 74 log.WithError(err).Errorf(a, "Invalid path specifier.") |
| 75 return 1 | 75 return 1 |
| 76 } | 76 } |
| 77 | 77 |
| 78 coord, err := a.coordinatorClient("") | 78 coord, err := a.coordinatorClient("") |
| 79 if err != nil { | 79 if err != nil { |
| 80 » » errors.Log(a, errors.Annotate(err).Reason("could not create Coor
dinator client").Err()) | 80 » » errors.Log(a, errors.Annotate(err, "could not create Coordinator
client").Err()) |
| 81 return 1 | 81 return 1 |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Open our output file, if necessary. | 84 // Open our output file, if necessary. |
| 85 w := io.Writer(nil) | 85 w := io.Writer(nil) |
| 86 switch cmd.out { | 86 switch cmd.out { |
| 87 case "-": | 87 case "-": |
| 88 w = os.Stdout | 88 w = os.Stdout |
| 89 default: | 89 default: |
| 90 f, err := os.OpenFile(cmd.out, os.O_WRONLY|os.O_CREATE|os.O_TRUN
C, 0643) | 90 f, err := os.OpenFile(cmd.out, os.O_WRONLY|os.O_CREATE|os.O_TRUN
C, 0643) |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 264 } |
| 265 | 265 |
| 266 func (p *jsonQueryOutput) end() error { | 266 func (p *jsonQueryOutput) end() error { |
| 267 if err := p.ensureStart(); err != nil { | 267 if err := p.ensureStart(); err != nil { |
| 268 return err | 268 return err |
| 269 } | 269 } |
| 270 | 270 |
| 271 _, err := p.WriteRune(']') | 271 _, err := p.WriteRune(']') |
| 272 return err | 272 return err |
| 273 } | 273 } |
| OLD | NEW |