Skip to content

Commit

Permalink
Merge pull request #40825 from thaJeztah/replace_term
Browse files Browse the repository at this point in the history
Deprecate pkg/term and make it an alias for github.com/moby/term
Upstream-commit: f6a5ccf492e8eab969ffad8404117806b4a15a35
Component: engine
  • Loading branch information
cpuguy83 authored Apr 22, 2020
2 parents 0ddb019 + c973908 commit 32ed0bc
Show file tree
Hide file tree
Showing 30 changed files with 400 additions and 371 deletions.
2 changes: 1 addition & 1 deletion components/engine/cli/cobra.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cli // import "github.com/docker/docker/cli"
import (
"fmt"

"github.com/docker/docker/pkg/term"
"github.com/moby/term"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion components/engine/cmd/dockerd/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/reexec"
"github.com/docker/docker/pkg/term"
"github.com/docker/docker/rootless"
"github.com/moby/buildkit/util/apicaps"
"github.com/moby/term"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion components/engine/container/stream/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"

"github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/term"
"github.com/moby/term"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
Expand Down
2 changes: 1 addition & 1 deletion components/engine/daemon/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/docker/docker/daemon/logger"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/term"
"github.com/moby/term"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion components/engine/daemon/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/term"
"github.com/moby/term"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion components/engine/pkg/jsonmessage/jsonmessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"time"

"github.com/docker/docker/pkg/term"
units "github.com/docker/go-units"
"github.com/moby/term"
"github.com/morikuni/aec"
)

Expand Down
2 changes: 1 addition & 1 deletion components/engine/pkg/jsonmessage/jsonmessage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/docker/docker/pkg/term"
"github.com/moby/term"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
Expand Down
25 changes: 0 additions & 25 deletions components/engine/pkg/term/ascii_test.go

This file was deleted.

84 changes: 84 additions & 0 deletions components/engine/pkg/term/deprecated.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Package term provides structures and helper functions to work with
// terminal (state, sizes).
//
// Deprecated: use github.com/moby/term instead
package term // import "github.com/docker/docker/pkg/term"

import (
"github.com/moby/term"
)

// EscapeError is special error which returned by a TTY proxy reader's Read()
// method in case its detach escape sequence is read.
// Deprecated: use github.com/moby/term.EscapeError
type EscapeError = term.EscapeError

// State represents the state of the terminal.
// Deprecated: use github.com/moby/term.State
type State = term.State

// Winsize represents the size of the terminal window.
// Deprecated: use github.com/moby/term.Winsize
type Winsize = term.Winsize

var (
// ASCII list the possible supported ASCII key sequence
ASCII = term.ASCII

// ToBytes converts a string representing a suite of key-sequence to the corresponding ASCII code.
// Deprecated: use github.com/moby/term.ToBytes
ToBytes = term.ToBytes

// StdStreams returns the standard streams (stdin, stdout, stderr).
// Deprecated: use github.com/moby/term.StdStreams
StdStreams = term.StdStreams

// GetFdInfo returns the file descriptor for an os.File and indicates whether the file represents a terminal.
// Deprecated: use github.com/moby/term.GetFdInfo
GetFdInfo = term.GetFdInfo

// GetWinsize returns the window size based on the specified file descriptor.
// Deprecated: use github.com/moby/term.GetWinsize
GetWinsize = term.GetWinsize

// IsTerminal returns true if the given file descriptor is a terminal.
// Deprecated: use github.com/moby/term.IsTerminal
IsTerminal = term.IsTerminal

// RestoreTerminal restores the terminal connected to the given file descriptor
// to a previous state.
// Deprecated: use github.com/moby/term.RestoreTerminal
RestoreTerminal = term.RestoreTerminal

// SaveState saves the state of the terminal connected to the given file descriptor.
// Deprecated: use github.com/moby/term.SaveState
SaveState = term.SaveState

// DisableEcho applies the specified state to the terminal connected to the file
// descriptor, with echo disabled.
// Deprecated: use github.com/moby/term.DisableEcho
DisableEcho = term.DisableEcho

// SetRawTerminal puts the terminal connected to the given file descriptor into
// raw mode and returns the previous state. On UNIX, this puts both the input
// and output into raw mode. On Windows, it only puts the input into raw mode.
// Deprecated: use github.com/moby/term.SetRawTerminal
SetRawTerminal = term.SetRawTerminal

// SetRawTerminalOutput puts the output of terminal connected to the given file
// descriptor into raw mode. On UNIX, this does nothing and returns nil for the
// state. On Windows, it disables LF -> CRLF translation.
// Deprecated: use github.com/moby/term.SetRawTerminalOutput
SetRawTerminalOutput = term.SetRawTerminalOutput

// MakeRaw puts the terminal connected to the given file descriptor into raw
// mode and returns the previous state of the terminal so that it can be restored.
// Deprecated: use github.com/moby/term.MakeRaw
MakeRaw = term.MakeRaw

// NewEscapeProxy returns a new TTY proxy reader which wraps the given reader
// and detects when the specified escape keys are read, in which case the Read
// method will return an error of type EscapeError.
// Deprecated: use github.com/moby/term.NewEscapeProxy
NewEscapeProxy = term.NewEscapeProxy
)
20 changes: 20 additions & 0 deletions components/engine/pkg/term/deprecated_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// +build !windows

package term // import "github.com/docker/docker/pkg/term"

import (
"github.com/moby/term"
)

// Termios is the Unix API for terminal I/O.
// Deprecated: use github.com/moby/term.Termios
type Termios = term.Termios

var (
// ErrInvalidState is returned if the state of the terminal is invalid.
ErrInvalidState = term.ErrInvalidState

// SetWinsize tries to set the specified window size for the specified file descriptor.
// Deprecated: use github.com/moby/term.GetWinsize
SetWinsize = term.SetWinsize
)
Loading

0 comments on commit 32ed0bc

Please sign in to comment.