Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,30 @@ permissions:

jobs:
call-workflow:
uses: antham/go-workflow-github-action/.github/workflows/build-library.yml@master
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Build
run: |
go build

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest

- name: Test
run: |
go test -race -cover -coverprofile=coverage.txt ./...

- name: Push on codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/antham/strumt/v2

require github.com/stretchr/testify v1.8.2
go 1.24

require github.com/stretchr/testify v1.11.1

require (
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
11 changes: 2 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 2 additions & 2 deletions prompt_example_multiline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package strumt_test
import (
"bytes"
"fmt"
"io/ioutil"
"io"

"github.com/antham/strumt/v2"
)
Expand All @@ -12,7 +12,7 @@ func Example_multilinePrompt() {
var datas []string
buf := "test1\ntest2\ntest3\ntest4\n\n"

p := strumt.NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), ioutil.Discard)
p := strumt.NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), io.Discard)
p.AddMultilinePrompter(&SlicePrompt{&datas})
p.SetFirst("sliceprompt")
p.Run()
Expand Down
4 changes: 2 additions & 2 deletions prompts_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package strumt_test
import (
"bytes"
"fmt"
"io/ioutil"
"io"
"strconv"

"github.com/antham/strumt/v2"
Expand All @@ -14,7 +14,7 @@ func Example() {

buf := "\nBrad\n\nBlanton\nwhatever\n0\n31\n"

p := strumt.NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), ioutil.Discard)
p := strumt.NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), io.Discard)
p.AddLinePrompter(&StringPrompt{&user.FirstName, "Enter your first name", "userName", "lastName", "userName"})
p.AddLinePrompter(&StringPrompt{&user.LastName, "Enter your last name", "lastName", "age", "lastName"})
p.AddLinePrompter(&IntPrompt{&user.Age, "Enter your age", "age", "", "age"})
Expand Down
3 changes: 1 addition & 2 deletions prompts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strconv"
Expand Down Expand Up @@ -291,7 +290,7 @@ func TestPromptRunWithCustomRenderer(t *testing.T) {
func TestPromptsScenario(t *testing.T) {
buf := "\nuser\n\npassword\ntest\n10000\n127.0.0.1\ntest\n1.2.3.4\n8.9.10.11\n\n127.0.0.1\n1.2.3.4\n8.9.10.11\n\nlocalhost:127.0.0.1\ntest\nmyIp:1.2.3.4\n\nlocalhost:127.0.0.1\nmyIp:1.2.3.4\n\n"

p := NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), ioutil.Discard)
p := NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), io.Discard)

p.AddLinePrompter(&StringPrompt{new(string), "Give a username", "username", "password", "username"})
p.AddLinePrompter(&StringPrompt{new(string), "Give a password", "password", "port", "password"})
Expand Down
Loading