RFC: migrate interactive prompts from survey to huh #945
nf-matt
started this conversation in
Feature Requests, Ideas
Replies: 1 comment
-
|
Ok, I have 9 PRs ready to go, or I can merge all of it locally and push as a single PR. Your call if you're interested. All tests/CI passing. Didn't turn out to be too difficult, and I like where it landed and I'm using it locally. Should make future granted/assume UI work easier and more flexible. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been using this project, and it's really helpful! I like to give back on projects I use. I went to add ESC key support and found some challenges related to AlecAivazis/survey -- archived (last release June 2023 with 74 open issues that probably won't be addressed).
Footprint in this repo:
Affected packages:
assume,alias,browser/detect,cfaws/{env,creds},granted/{credentials,sso,tokens,uninstall}, all ofgranted/settings/*, all ofgranted/registry/*, plus thepkg/testableshim.Beyond the unmaintained risk, survey's API is awkward:
pkg/assume/assume.go:670monkey-patches the package-globalsurvey.SelectQuestionTemplateto render the profile-list header row, then restores it. A theme would be cleaner.pkg/assume/assume.go:660builds aprofileNameMap(display-string → real-name) becausesurvey.Select.Optionsis "stringly" typed. Generic select erases this.There's no clean way to add an ESC-cancel keybinding to
survey.Select(it has no key-handler hook).Proposed approach — incremental, no big PR:
pkg/testable, add huh alongside survey, migratepkg/cfaws/env.go(a single Confirm).pkg/assume/assume.go(the only place that needs the custom template/theme work).surveydep.Each PR is independently revertible and ships behavior-equivalent UX.
huh vs. promptui: promptui last released in 2021 (also effectively dormant). huh is active (latest is March 2026), has generic-typed Select, theming as a first-class concept, and ESC-cancel built in. It's Bubble Tea–based, so the testable shim needs the interface refactor (PR 2) rather than a transparent pass-through.
Before I write any code, is this something you'd be open to? Happy to drive the work if you're open to it. Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions