aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/containers/common/pkg/auth/cli.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/containers/common/pkg/auth/cli.go')
-rw-r--r--vendor/github.com/containers/common/pkg/auth/cli.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/vendor/github.com/containers/common/pkg/auth/cli.go b/vendor/github.com/containers/common/pkg/auth/cli.go
index 3384b0731..ab033681d 100644
--- a/vendor/github.com/containers/common/pkg/auth/cli.go
+++ b/vendor/github.com/containers/common/pkg/auth/cli.go
@@ -7,16 +7,19 @@ import (
)
// LoginOptions represents common flags in login
-// caller should define bool or optionalBool fields for flags --get-login and --tls-verify
+// In addition, the caller should probably provide a --tls-verify flag (that affects the provided
+// *types.SystemContest)
type LoginOptions struct {
// CLI flags managed by the FlagSet returned by GetLoginFlags
+ // Callers that use GetLoginFlags should not need to touch these values at all; callers that use
+ // other CLI frameworks should set them based on user input.
AuthFile string
CertDir string
Password string
Username string
StdinPassword bool
+ GetLoginSet bool
// Options caller can set
- GetLoginSet bool // set to true if --get-login is explicitly set
Stdin io.Reader // set to os.Stdin
Stdout io.Writer // set to os.Stdout
AcceptUnspecifiedRegistry bool // set to true if allows login with unspecified registry
@@ -25,10 +28,11 @@ type LoginOptions struct {
// LogoutOptions represents the results for flags in logout
type LogoutOptions struct {
// CLI flags managed by the FlagSet returned by GetLogoutFlags
+ // Callers that use GetLogoutFlags should not need to touch these values at all; callers that use
+ // other CLI frameworks should set them based on user input.
AuthFile string
All bool
// Options caller can set
- Stdin io.Reader // set to os.Stdin
Stdout io.Writer // set to os.Stdout
AcceptUnspecifiedRegistry bool // set to true if allows logout with unspecified registry
}
@@ -41,6 +45,7 @@ func GetLoginFlags(flags *LoginOptions) *pflag.FlagSet {
fs.StringVarP(&flags.Password, "password", "p", "", "Password for registry")
fs.StringVarP(&flags.Username, "username", "u", "", "Username for registry")
fs.BoolVar(&flags.StdinPassword, "password-stdin", false, "Take the password from stdin")
+ fs.BoolVar(&flags.GetLoginSet, "get-login", false, "Return the current login user for the registry")
return &fs
}