go.fuchsia.dev/infra@v0.0.0-20240507153436-9b593402251b/cmd/cipd-resolver/common.go (about) 1 // Copyright 2022 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package main 6 7 import ( 8 "github.com/maruel/subcommands" 9 "go.chromium.org/luci/auth" 10 "go.chromium.org/luci/auth/client/authcli" 11 ) 12 13 type commonFlags struct { 14 subcommands.CommandRunBase 15 16 authFlags authcli.Flags 17 parsedAuthOpts auth.Options 18 } 19 20 func (c *commonFlags) Init(authOpts auth.Options) { 21 c.authFlags.Register(&c.Flags, authOpts) 22 } 23 24 func (c *commonFlags) Parse() error { 25 var err error 26 c.parsedAuthOpts, err = c.authFlags.Options() 27 if err != nil { 28 return err 29 } 30 return nil 31 }