1
0
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:
avaid96
2016-07-13 10:20:51 -07:00
parent 887a66459a
commit 8fa18eb16c
3 changed files with 25 additions and 3 deletions
+13 -2
View File
@@ -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
}