| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package main | 5 package main |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "errors" | 8 "errors" |
| 9 "fmt" | 9 "fmt" |
| 10 "io" | 10 "io" |
| 11 "io/ioutil" | 11 "io/ioutil" |
| 12 "log" | 12 "log" |
| 13 "os" | 13 "os" |
| 14 | 14 |
| 15 "github.com/luci/luci-go/client/internal/common" | 15 "github.com/luci/luci-go/client/internal/common" |
| 16 "github.com/luci/luci-go/client/internal/lhttp" |
| 16 "github.com/luci/luci-go/client/internal/tracer" | 17 "github.com/luci/luci-go/client/internal/tracer" |
| 17 "github.com/luci/luci-go/client/isolate" | 18 "github.com/luci/luci-go/client/isolate" |
| 18 "github.com/maruel/subcommands" | 19 "github.com/maruel/subcommands" |
| 19 ) | 20 ) |
| 20 | 21 |
| 21 type commonFlags struct { | 22 type commonFlags struct { |
| 22 quiet bool | 23 quiet bool |
| 23 verbose bool | 24 verbose bool |
| 24 tracePath string | 25 tracePath string |
| 25 traceFile io.Closer | 26 traceFile io.Closer |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 b.Flags.StringVar(&c.serverURL, "isolate-server", i, | 75 b.Flags.StringVar(&c.serverURL, "isolate-server", i, |
| 75 "Isolate server to use; defaults to value of $ISOLATE_SERVER") | 76 "Isolate server to use; defaults to value of $ISOLATE_SERVER") |
| 76 b.Flags.StringVar(&c.serverURL, "I", i, "Alias for -isolate-server") | 77 b.Flags.StringVar(&c.serverURL, "I", i, "Alias for -isolate-server") |
| 77 b.Flags.StringVar(&c.namespace, "namespace", "default-gzip", "") | 78 b.Flags.StringVar(&c.namespace, "namespace", "default-gzip", "") |
| 78 } | 79 } |
| 79 | 80 |
| 80 func (c *commonServerFlags) Parse() error { | 81 func (c *commonServerFlags) Parse() error { |
| 81 if c.serverURL == "" { | 82 if c.serverURL == "" { |
| 82 return errors.New("-isolate-server must be specified") | 83 return errors.New("-isolate-server must be specified") |
| 83 } | 84 } |
| 84 » if s, err := common.URLToHTTPS(c.serverURL); err != nil { | 85 » if s, err := lhttp.URLToHTTPS(c.serverURL); err != nil { |
| 85 return err | 86 return err |
| 86 } else { | 87 } else { |
| 87 c.serverURL = s | 88 c.serverURL = s |
| 88 } | 89 } |
| 89 if c.namespace == "" { | 90 if c.namespace == "" { |
| 90 return errors.New("-namespace must be specified.") | 91 return errors.New("-namespace must be specified.") |
| 91 } | 92 } |
| 92 return nil | 93 return nil |
| 93 } | 94 } |
| 94 | 95 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 146 |
| 146 if flags&RequireIsolateFile != 0 && c.Isolate == "" { | 147 if flags&RequireIsolateFile != 0 && c.Isolate == "" { |
| 147 return errors.New("-isolate must be specified") | 148 return errors.New("-isolate must be specified") |
| 148 } | 149 } |
| 149 if flags&RequireIsolatedFile != 0 && c.Isolated == "" { | 150 if flags&RequireIsolatedFile != 0 && c.Isolated == "" { |
| 150 return errors.New("-isolated must be specified") | 151 return errors.New("-isolated must be specified") |
| 151 } | 152 } |
| 152 | 153 |
| 153 return nil | 154 return nil |
| 154 } | 155 } |
| OLD | NEW |