Extract streams helpers from command package to their own package to remove a cyclic dependency from command to internal/containerizedengine
Aliasing old types * streams.InStream -> streams.In * streams.NewInStream -> streams.NewIn * streams.OutStream -> streams.Out * streams.NewOutStream -> streams.NewOut Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/docker/cli/cli"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/cli/cli/streams"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
@ -59,7 +60,7 @@ func runUnlock(dockerCli command.Cli) error {
|
||||
return client.SwarmUnlock(ctx, req)
|
||||
}
|
||||
|
||||
func readKey(in *command.InStream, prompt string) (string, error) {
|
||||
func readKey(in *streams.In, prompt string) (string, error) {
|
||||
if in.IsTerminal() {
|
||||
fmt.Print(prompt)
|
||||
dt, err := terminal.ReadPassword(int(in.FD()))
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/cli/cli/streams"
|
||||
"github.com/docker/cli/internal/test"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
@ -92,7 +92,7 @@ func TestSwarmUnlock(t *testing.T) {
|
||||
return nil
|
||||
},
|
||||
})
|
||||
dockerCli.SetIn(command.NewInStream(ioutil.NopCloser(strings.NewReader(input))))
|
||||
dockerCli.SetIn(streams.NewIn(ioutil.NopCloser(strings.NewReader(input))))
|
||||
cmd := newUnlockCommand(dockerCli)
|
||||
assert.NilError(t, cmd.Execute())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user