mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
godoc: credentials helper -> credentials-helper
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -21,14 +21,14 @@ const (
|
|||||||
var errProgramExited = fmt.Errorf("exited 1")
|
var errProgramExited = fmt.Errorf("exited 1")
|
||||||
|
|
||||||
// mockProgram simulates interactions between the docker client and a remote
|
// mockProgram simulates interactions between the docker client and a remote
|
||||||
// credentials helper.
|
// credentials-helper.
|
||||||
// Unit tests inject this mocked command into the remote to control execution.
|
// Unit tests inject this mocked command into the remote to control execution.
|
||||||
type mockProgram struct {
|
type mockProgram struct {
|
||||||
arg string
|
arg string
|
||||||
input io.Reader
|
input io.Reader
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output returns responses from the remote credentials helper.
|
// Output returns responses from the remote credentials-helper.
|
||||||
// It mocks those responses based in the input in the mock.
|
// It mocks those responses based in the input in the mock.
|
||||||
func (m *mockProgram) Output() ([]byte, error) {
|
func (m *mockProgram) Output() ([]byte, error) {
|
||||||
in, err := io.ReadAll(m.input)
|
in, err := io.ReadAll(m.input)
|
||||||
@@ -80,7 +80,7 @@ func (m *mockProgram) Output() ([]byte, error) {
|
|||||||
return []byte(fmt.Sprintf("unknown argument %q with %q", m.arg, inS)), errProgramExited
|
return []byte(fmt.Sprintf("unknown argument %q with %q", m.arg, inS)), errProgramExited
|
||||||
}
|
}
|
||||||
|
|
||||||
// Input sets the input to send to a remote credentials helper.
|
// Input sets the input to send to a remote credentials-helper.
|
||||||
func (m *mockProgram) Input(in io.Reader) {
|
func (m *mockProgram) Input(in io.Reader) {
|
||||||
m.input = in
|
m.input = in
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -38,17 +38,17 @@ func createProgramCmdRedirectErr(commandName string, args []string, env *map[str
|
|||||||
return programCmd
|
return programCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shell invokes shell commands to talk with a remote credentials helper.
|
// Shell invokes shell commands to talk with a remote credentials-helper.
|
||||||
type Shell struct {
|
type Shell struct {
|
||||||
cmd *exec.Cmd
|
cmd *exec.Cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output returns responses from the remote credentials helper.
|
// Output returns responses from the remote credentials-helper.
|
||||||
func (s *Shell) Output() ([]byte, error) {
|
func (s *Shell) Output() ([]byte, error) {
|
||||||
return s.cmd.Output()
|
return s.cmd.Output()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Input sets the input to send to a remote credentials helper.
|
// Input sets the input to send to a remote credentials-helper.
|
||||||
func (s *Shell) Input(in io.Reader) {
|
func (s *Shell) Input(in io.Reader) {
|
||||||
s.cmd.Stdin = in
|
s.cmd.Stdin = in
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func SetCredsLabel(label string) {
|
|||||||
CredsLabel = label
|
CredsLabel = label
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serve initializes the credentials helper and parses the action argument.
|
// Serve initializes the credentials-helper and parses the action argument.
|
||||||
// This function is designed to be called from a command line interface.
|
// This function is designed to be called from a command line interface.
|
||||||
// It uses os.Args[1] as the key for the action.
|
// It uses os.Args[1] as the key for the action.
|
||||||
// It uses os.Stdin as input and os.Stdout as output.
|
// It uses os.Stdin as input and os.Stdout as output.
|
||||||
|
|||||||
Reference in New Issue
Block a user