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

fix(deps): update module github.com/charmbracelet/huh to v0.5.1 in go.mod #60

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jul 10, 2024

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
github.com/charmbracelet/huh v0.4.2 -> v0.5.1 age adoption passing confidence

Release Notes

charmbracelet/huh (github.com/charmbracelet/huh)

v0.5.1

Compare Source

v0.5.0

Compare Source

Dynamic Forms 🪄

Country / State form with dynamic inputs running.

huh? forms can now react to changes in other parts of the form. Replace properties such as Options, Title, Description with their dynamic counterparts: OptionsFunc, TitleFunc, and DescriptionFunc to recompute properties values on changes when watched variables change.

Let’s build a simple state / province picker.

var country string
var state string

The country select will be static, we’ll use this value to recompute the
options and title for the next input.

huh.NewSelect[string]().
    Options(huh.NewOptions("United States", "Canada", "Mexico")...).
    Value(&country).
    Title("Country").

Define your Select with TitleFunc and OptionsFunc and bind them to the
&country value from the previous field. Whenever the user chooses a different
country, the TitleFunc and OptionsFunc will be recomputed.

[!IMPORTANT]
We have to pass &country as the binding to recompute the function only when
country changes, otherwise we will hit the API too often.

huh.NewSelect[string]().
    Value(&state).
    Height(8).
    TitleFunc(func() string {
        switch country {
        case "United States":
            return "State"
        case "Canada":
            return "Province"
        default:
            return "Territory"
        }
    }, &country).
    OptionsFunc(func() []huh.Option[string] {
        opts := fetchStatesForCountry(country)
        return huh.NewOptions(opts...)
    }, &country),

Lastly, run the form with these inputs.

err := form.Run()
if err != nil {
    log.Fatal(err)
}
Other Changes

What's Changed

New Contributors

Full Changelog: charmbracelet/huh@v0.4.2...v0.5.0


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.


Configuration

📅 Schedule: Branch creation - "* */8 * * *" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

Copy link
Contributor Author

renovate bot commented Jul 10, 2024

ℹ Artifact update notice

File name: go.mod

In order to perform the update(s) described in the table above, Renovate ran the go get command, which resulted in the following additional change(s):

  • 6 additional dependencies were updated

Details:

Package Change
github.com/charmbracelet/bubbletea v0.26.3 -> v0.26.4
github.com/charmbracelet/x/ansi v0.1.1 -> v0.1.2
github.com/charmbracelet/x/exp/strings v0.0.0-20240524151031-ff83003bf67a -> v0.0.0-20240617190524-788ec55faed1
github.com/charmbracelet/x/input v0.1.1 -> v0.1.2
golang.org/x/sys v0.20.0 -> v0.21.0
golang.org/x/text v0.15.0 -> v0.16.0

@renovate renovate bot enabled auto-merge (squash) July 10, 2024 08:01
Copy link

codecov bot commented Jul 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.48%. Comparing base (7f90221) to head (0e949b6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #60   +/-   ##
=======================================
  Coverage   68.48%   68.48%           
=======================================
  Files          67       67           
  Lines        3506     3506           
=======================================
  Hits         2401     2401           
  Misses        980      980           
  Partials      125      125           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@renovate renovate bot force-pushed the renovate/charmbracelet branch from 0e949b6 to 1855297 Compare July 10, 2024 13:19
@renovate renovate bot merged commit 4b3577f into main Jul 10, 2024
6 of 7 checks passed
@renovate renovate bot deleted the renovate/charmbracelet branch July 10, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants