Skip to content

feat: make Field.RunAccessible public, deprecate Field.WithAccessible - #667

Merged
caarlos0 merged 2 commits into
mainfrom
huh-accessible
Jul 10, 2025
Merged

caarlos0 merged 2 commits into
mainfrom
huh-accessible

Conversation

@caarlos0

@caarlos0 caarlos0 commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

This way we can remove make the public interface Field implementable by 3rd parties again.

closes #663

This way we can remove make the public interface Field implementable by
3rd parties again.

closes #663
@caarlos0 caarlos0 self-assigned this Jul 9, 2025
@caarlos0
caarlos0 requested a review from a team as a code owner July 9, 2025 15:22
@caarlos0
caarlos0 requested review from Copilot, meowgorithm and raphamorim and removed request for a team and raphamorim July 9, 2025 15:22
@caarlos0 caarlos0 added the enhancement New feature or request label Jul 9, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR makes the RunAccessible method part of the public Field interface, deprecates the old WithAccessible flag, and updates all field implementations and tests to use the new method.

  • Exported runAccessible as RunAccessible in Field and all concrete types, and marked WithAccessible as deprecated.
  • Updated internal calls and tests to invoke RunAccessible.
  • Simplified manual width calculation in Confirm.View() to use a max helper.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
huh_test.go Updated tests to call RunAccessible instead of runAccessible.
form.go Exported RunAccessible in Field interface; deprecated WithAccessible.
field_text.go Renamed runAccessible to RunAccessible; added deprecation notes.
field_select.go Same renaming and deprecation updates for select fields.
field_note.go Same renaming and deprecation updates for note fields.
field_multiselect.go Same renaming and deprecation updates for multiselect fields.
field_input.go Same renaming and deprecation updates for input fields.
field_filepicker.go Same renaming and deprecation updates for file picker.
field_confirm.go Same renaming and deprecation updates for confirm; replaced inline max logic.
Comments suppressed due to low confidence (1)

field_confirm.go:288

  • The helper function max is not part of Go's standard library and isn't defined in this file, leading to a compile error. Either restore the inline comparison or add a max helper implementation.
	renderWidth := max(buttonsWidth, promptWidth)

@lyssar

lyssar commented Jul 10, 2025

Copy link
Copy Markdown

@caarlos0 ask me to look at his changes. They look good to me but I'm not sure about the process (should I do the review and approve it? is this done by someone else?)

@caarlos0

Copy link
Copy Markdown
Contributor Author

@caarlos0 ask me to look at his changes. They look good to me but I'm not sure about the process (should I do the review and approve it? is this done by someone else?)

if you feel like it, go for it :)

@caarlos0
caarlos0 merged commit b8be3ec into main Jul 10, 2025
@caarlos0
caarlos0 deleted the huh-accessible branch July 10, 2025 14:46
jonas-grgt pushed a commit to jonas-grgt/huh that referenced this pull request Nov 12, 2025
…harmbracelet#667)

* feat: make Field.RunAccessible public, deprecate Field.WithAccessible

This way we can remove make the public interface Field implementable by
3rd parties again.

closes charmbracelet#663

* fix: lint issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change Request: Make huh.Field interface implementable again

4 participants

⌂ 换网址