| Index: cipd/client/cmd/cipd/main.go
|
| diff --git a/cipd/client/cmd/cipd/main.go b/cipd/client/cmd/cipd/main.go
|
| index a94381f4d331650370cb23342c0a927426b71be5..bfad54021d40538197958fbb828dd9b0148cb759 100644
|
| --- a/cipd/client/cmd/cipd/main.go
|
| +++ b/cipd/client/cmd/cipd/main.go
|
| @@ -235,10 +235,13 @@ type ClientOptions struct {
|
| authFlags authcli.Flags
|
| serviceURL string
|
| cacheDir string
|
| + userAgent string
|
| }
|
|
|
| func (opts *ClientOptions) registerFlags(f *flag.FlagSet) {
|
| f.StringVar(&opts.serviceURL, "service-url", "", "URL of a backend to use instead of the default one.")
|
| + f.StringVar(&opts.userAgent, "http-user-agent", "",
|
| + "User Agent text to add. If specified, the UA will be '<this_option>/"+cipd.UserAgent+"'.")
|
| f.StringVar(&opts.cacheDir, "cache-dir", "", "Directory for shared cache")
|
| opts.authFlags.Register(f, auth.Options{})
|
| }
|
| @@ -252,9 +255,14 @@ func (opts *ClientOptions) makeCipdClient(ctx context.Context, root string) (cip
|
| if err != nil {
|
| return nil, err
|
| }
|
| + ua := cipd.UserAgent
|
| + if opts.userAgent != "" {
|
| + ua = fmt.Sprintf("%s/%s", opts.userAgent, ua)
|
| + }
|
| return cipd.NewClient(cipd.ClientOptions{
|
| ServiceURL: opts.serviceURL,
|
| Root: root,
|
| + UserAgent: ua,
|
| CacheDir: opts.cacheDir,
|
| AuthenticatedClient: client,
|
| AnonymousClient: http.DefaultClient,
|
|
|