Skip to content

Commit

Permalink
chore: remove github.com/hinshun/vt10x replacement
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <[email protected]>
  • Loading branch information
matejvasek committed Aug 28, 2023
1 parent 3729477 commit b7e62d2
Show file tree
Hide file tree
Showing 22 changed files with 585 additions and 551 deletions.
14 changes: 11 additions & 3 deletions cmd/config_labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import (
"time"

"github.com/Netflix/go-expect"
"github.com/creack/pty"
"github.com/hinshun/vt10x"
"github.com/spf13/cobra"

fn "knative.dev/func/pkg/functions"
)

Expand Down Expand Up @@ -41,11 +43,17 @@ func createRunFunc(cmd *cobra.Command, t *testing.T) func(subcmd string, input .
return func(subcmd string, input ...string) {

ctx := context.Background()
c, _, err := vt10x.NewVT10XConsole()

ptm, pts, err := pty.Open()
if err != nil {
t.Fatal(err)
}
term := vt10x.New(vt10x.WithWriter(pts))
c, err := expect.NewConsole(expect.WithStdin(ptm), expect.WithStdout(term), expect.WithCloser(ptm, pts))
if err != nil {
t.Fatal(err)
}
defer c.Close()
t.Cleanup(func() { c.Close() })

var wg sync.WaitGroup
wg.Add(1)
Expand Down Expand Up @@ -147,7 +155,7 @@ func TestListLabels(t *testing.T) {
cmd.SetArgs([]string{})

ctx := context.Background()
c, _, err := vt10x.NewVT10XConsole()
c, err := expect.NewConsole()
if err != nil {
t.Fatal(err)
}
Expand Down
11 changes: 9 additions & 2 deletions cmd/prompt/prompt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"testing"
"time"

"github.com/Netflix/go-expect"
"github.com/creack/pty"
"github.com/hinshun/vt10x"

"knative.dev/func/pkg/docker"
Expand All @@ -24,11 +26,16 @@ func Test_NewPromptForCredentials(t *testing.T) {
Password: "testpwd",
}

console, _, err := vt10x.NewVT10XConsole()
ptm, pts, err := pty.Open()
if err != nil {
t.Fatal(err)
}
defer console.Close()
term := vt10x.New(vt10x.WithWriter(pts))
console, err := expect.NewConsole(expect.WithStdin(ptm), expect.WithStdout(term), expect.WithCloser(ptm, pts))
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { console.Close() })

go func() {
_, _ = console.ExpectEOF()
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ replace (
// Use older version since it checks ~/.docker/config.json for credentials as opposed to later versions
github.com/containers/image/v5 => github.com/containers/image/v5 v5.23.1

// Tekton CLI uses newer version without currently used constructor code
github.com/hinshun/vt10x => github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c
// Pin k8s.io dependencies to align with Knative and Tekton needs
k8s.io/api => k8s.io/api v0.26.5
k8s.io/apimachinery => k8s.io/apimachinery v0.26.5
Expand All @@ -25,6 +23,7 @@ require (
github.com/containerd/containerd v1.7.2
github.com/containers/image/v5 v5.26.1
github.com/coreos/go-semver v0.3.0
github.com/creack/pty v1.1.18
github.com/docker/cli v24.0.2+incompatible
github.com/docker/docker v24.0.5-0.20230718221249-d4a26c153000+incompatible
github.com/docker/docker-credential-helpers v0.7.0
Expand Down Expand Up @@ -119,7 +118,6 @@ require (
github.com/containerd/typeurl v1.0.2 // indirect
github.com/containers/storage v1.48.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/creack/pty v1.1.18 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/ristretto v0.0.1 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
Expand Down Expand Up @@ -173,7 +171,6 @@ require (
github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.16.6 // indirect
github.com/kr/pty v1.1.8 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand Down
7 changes: 3 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,9 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/heroku/color v0.0.6 h1:UTFFMrmMLFcL3OweqP1lAdp8i1y/9oHqkeHjQ/b/Ny0=
github.com/heroku/color v0.0.6/go.mod h1:ZBvOcx7cTF2QKOv4LbmoBtNl5uB17qWxGuzZrsi1wLU=
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c h1:kp3AxgXgDOmIJFR7bIwqFhwJ2qWar8tEQSE5XXhCfVk=
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/hinshun/vt10x v0.0.0-20220228203356-1ab2cad5fd82 h1:uf1FmugJNeFovjWtxD7FSPWQXdi0KuKnZfvN4CFUAtA=
github.com/hinshun/vt10x v0.0.0-20220228203356-1ab2cad5fd82/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 h1:i462o439ZjprVSFSZLZxcsoAe592sZB1rci2Z8j4wdk=
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA=
Expand Down Expand Up @@ -616,8 +617,6 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
Expand Down
11 changes: 9 additions & 2 deletions test/common/iteractivecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"testing"
"time"

"github.com/Netflix/go-expect"
"github.com/creack/pty"
"github.com/hinshun/vt10x"
)

Expand Down Expand Up @@ -60,11 +62,16 @@ func (f *TestInteractiveCmd) PrepareRun(funcCommand ...string) func(args ...stri
}

// Prepare terminal emulator
c, _, err := vt10x.NewVT10XConsole()
ptm, pts, err := pty.Open()
if err != nil {
f.T.Fatal(err)
}
defer c.Close()
term := vt10x.New(vt10x.WithWriter(pts))
c, err := expect.NewConsole(expect.WithStdin(ptm), expect.WithStdout(term), expect.WithCloser(ptm, pts))
if err != nil {
f.T.Fatal(err)
}
f.T.Cleanup(func() { c.Close() })

// Prepare and start command on terminal emulator
var stdout bytes.Buffer
Expand Down
23 changes: 0 additions & 23 deletions third_party/VENDOR-LICENSE/github.com/kr/pty/LICENSE

This file was deleted.

96 changes: 0 additions & 96 deletions vendor/github.com/hinshun/vt10x/Gopkg.lock

This file was deleted.

38 changes: 0 additions & 38 deletions vendor/github.com/hinshun/vt10x/Gopkg.toml

This file was deleted.

5 changes: 3 additions & 2 deletions vendor/github.com/hinshun/vt10x/color.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b7e62d2

Please sign in to comment.