| // Copyright 2022 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| package main |
| |
| import ( |
| "github.com/maruel/subcommands" |
| "go.chromium.org/luci/auth" |
| "go.chromium.org/luci/auth/client/authcli" |
| ) |
| |
| type commonFlags struct { |
| subcommands.CommandRunBase |
| authFlags authcli.Flags |
| verbose bool |
| veryVerbose bool |
| quiet bool |
| |
| parsedAuthOpts auth.Options |
| } |
| |
| func (c *commonFlags) Init(authOpts auth.Options) { |
| c.authFlags = authcli.Flags{} |
| c.authFlags.Register(&c.Flags, authOpts) |
| c.Flags.BoolVar(&c.verbose, "verbose", false, "Enable additional informational output") |
| c.Flags.BoolVar(&c.verbose, "v", false, "Enable additional informational output") |
| c.Flags.BoolVar(&c.veryVerbose, "vv", false, "Enable much more informational output") |
| c.Flags.BoolVar(&c.quiet, "quiet", false, "Disable all CLI output") |
| c.Flags.BoolVar(&c.quiet, "q", false, "Disable all CLI output") |
| } |
| |
| func (c *commonFlags) Parse() error { |
| var err error |
| c.parsedAuthOpts, err = c.authFlags.Options() |
| return err |
| } |