Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace survey library with bubbletea #54

Merged
merged 20 commits into from
Oct 19, 2023
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
21 changes: 15 additions & 6 deletions examples/variable-types/recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vars:

- name: BOOLEAN_VAR
description: |
Boolean variable can have value either `true` or `false`.
Boolean variable can have value either `true` or `false`.

Defined by: `confirm: true`.
confirm: true
Expand All @@ -32,7 +32,7 @@ vars:
{{ .Variables.TABLE_VAR[0].COLUMN_1 }}

You can pre-set the table variable by using CSV with having '\n' between the rows, for example:
`jalapeno execute examples/variables `--set 'TABLE_VAR=a;b;c\nx;y;z'`
`jalapeno execute examples/variables `--set 'TABLE_VAR=a,b,c\nx,y,z'`

Defined by: non-empty `columns` property.
columns: [COLUMN_1, COLUMN_2, COLUMN_3]
Expand Down Expand Up @@ -63,7 +63,16 @@ vars:

- name: VAR_WITH_VALIDATOR
description: |
Regular expression validators can be set for a variable by defining `regexp` property
regexp:
pattern: ".*"
help: "If the check doesn't pass, this help message will be shown"
Regular expression validators can be set for a variable by defining `validators` property
validators:
- pattern: ".+"
help: "If the value is empty, this help message will be shown"

- name: TABLE_VAR_WITH_VALIDATOR
description: |
Regular expression validators can be set for a table variable by defining `validators` and `column` property
columns: [NOT_EMPTY_COL, CAN_BE_EMPTY_COL]
validators:
- pattern: ".+"
column: NOT_EMPTY_COL
help: "If the cell is empty, this help message will be shown"
13 changes: 4 additions & 9 deletions examples/variable-types/templates/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# String variable
# String variable: {{ .Variables.STRING_VAR }}

{{- .Variables.STRING_VAR }}
# Boolean variable: {{ .Variables.BOOLEAN_VAR }}

# Boolean variable

{{- .Variables.BOOLEAN_VAR }}

# Select variable

{{- .Variables.SELECT_VAR }}
# Select variable: {{ .Variables.SELECT_VAR }}

# Table variable

| COLUMN_1 | COLUMN_2 | COLUMN_3 |
| --- | --- | --- |
{{- range $val := .Variables.TABLE_VAR }}
| {{ $val.COLUMN_1 }} | {{ $val.COLUMN_2 }} | {{ $val.COLUMN_3 }} |
{{- end}}
23 changes: 18 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ module github.com/futurice/jalapeno
go 1.21

require (
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/antonmedv/expr v1.15.3
github.com/carlmjohnson/versioninfo v0.22.5
github.com/charmbracelet/bubbles v0.16.1
github.com/charmbracelet/bubbletea v0.24.2
github.com/charmbracelet/lipgloss v0.9.1
github.com/charmbracelet/x/exp/teatest v0.0.0-20231010190216-1cb11efc897d
github.com/cucumber/godog v0.13.0
github.com/docker/cli v24.0.6+incompatible
github.com/muesli/termenv v0.15.2
github.com/opencontainers/image-spec v1.1.0-rc5
github.com/spf13/cobra v1.7.0
github.com/xlab/treeprint v1.2.0
Expand All @@ -18,16 +22,28 @@ require (
)

require (
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymanbagabas/go-udiff v0.1.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/cucumber/gherkin/go/v26 v26.2.0 // indirect
github.com/cucumber/messages/go/v21 v21.0.1 // indirect
github.com/docker/docker v24.0.6+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/sahilm/fuzzy v0.1.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
Expand All @@ -53,10 +69,7 @@ require (
github.com/huandu/xstrings v1.4.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/opencontainers/runc v1.1.9 // indirect
Expand All @@ -65,7 +78,7 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.13.0 // indirect
Expand Down
Loading