mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
implementation on client side as well, complete with tests
Signed-off-by: avaid96 <avaid1996@gmail.com>
This commit is contained in:
+13
-2
@@ -55,11 +55,10 @@ func Get(program ProgramFunc, serverURL string) (*credentials.Credentials, error
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Erase executes a program to remove the server credentails from the native store.
|
||||
// Erase executes a program to remove the server credentials from the native store.
|
||||
func Erase(program ProgramFunc, serverURL string) error {
|
||||
cmd := program("erase")
|
||||
cmd.Input(strings.NewReader(serverURL))
|
||||
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
t := strings.TrimSpace(string(out))
|
||||
@@ -68,3 +67,15 @@ func Erase(program ProgramFunc, serverURL string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// List executes a program to remove the server credentials from the native store.
|
||||
func List(program ProgramFunc) error {
|
||||
cmd := program("list")
|
||||
cmd.Input(strings.NewReader("garbage"))
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
t := strings.TrimSpace(string(out))
|
||||
return fmt.Errorf("error listing credentials - err: %v, out: `%s`", err, t)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user