diff options
author | Michael Muré <batolettre@gmail.com> | 2020-07-28 12:56:46 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-09-29 20:42:21 +0200 |
commit | 3ecbf8db28105d147340b80d65a5a6d537233135 (patch) | |
tree | 9bda351f7d1d520fa0ae51b155792ffca3517a9d /bridge/core/auth/options.go | |
parent | b127481364176ac7ecb56c1604e1460251574859 (diff) | |
download | git-bug-3ecbf8db28105d147340b80d65a5a6d537233135.tar.gz |
bridge: store credentials in the Keyring instead of the git config
Diffstat (limited to 'bridge/core/auth/options.go')
-rw-r--r-- | bridge/core/auth/options.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/bridge/core/auth/options.go b/bridge/core/auth/options.go index 1d8c44d1..00c6e3ec 100644 --- a/bridge/core/auth/options.go +++ b/bridge/core/auth/options.go @@ -1,22 +1,22 @@ package auth -type options struct { +type listOptions struct { target string kind map[CredentialKind]interface{} meta map[string]string } -type Option func(opts *options) +type ListOption func(opts *listOptions) -func matcher(opts []Option) *options { - result := &options{} +func matcher(opts []ListOption) *listOptions { + result := &listOptions{} for _, opt := range opts { opt(result) } return result } -func (opts *options) Match(cred Credential) bool { +func (opts *listOptions) Match(cred Credential) bool { if opts.target != "" && cred.Target() != opts.target { return false } @@ -35,15 +35,15 @@ func (opts *options) Match(cred Credential) bool { return true } -func WithTarget(target string) Option { - return func(opts *options) { +func WithTarget(target string) ListOption { + return func(opts *listOptions) { opts.target = target } } // WithKind match credentials with the given kind. Can be specified multiple times. -func WithKind(kind CredentialKind) Option { - return func(opts *options) { +func WithKind(kind CredentialKind) ListOption { + return func(opts *listOptions) { if opts.kind == nil { opts.kind = make(map[CredentialKind]interface{}) } @@ -51,8 +51,8 @@ func WithKind(kind CredentialKind) Option { } } -func WithMeta(key string, val string) Option { - return func(opts *options) { +func WithMeta(key string, val string) ListOption { + return func(opts *listOptions) { if opts.meta == nil { opts.meta = make(map[string]string) } |