Show help with Huh? (#587)

* chore(deps): bump deps

* feat: show help using huh?

* fix: lint

* fix: test.sh
This commit is contained in:
Maas Lalani 2024-05-25 14:51:20 -04:00 committed by GitHub
commit a8712df2a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 95 additions and 67 deletions

View file

@ -30,6 +30,9 @@ func (o Options) Run() error {
theme.Focused.Directory = o.DirectoryStyle.ToLipgloss()
theme.Focused.SelectedOption = o.SelectedStyle.ToLipgloss()
keymap := huh.NewDefaultKeyMap()
keymap.FilePicker.Open.SetEnabled(false)
// XXX: These should be file selected specific.
theme.Focused.TextInput.Placeholder = o.PermissionsStyle.ToLipgloss()
theme.Focused.TextInput.Prompt = o.CursorStyle.ToLipgloss()
@ -46,7 +49,8 @@ func (o Options) Run() error {
Value(&path),
),
).
WithShowHelp(false).
WithShowHelp(o.ShowHelp).
WithKeyMap(keymap).
WithTheme(theme).
Run()

View file

@ -15,6 +15,7 @@ type Options struct {
All bool `short:"a" help:"Show hidden and 'dot' files" default:"false" env:"GUM_FILE_ALL"`
File bool `help:"Allow files selection" default:"true" env:"GUM_FILE_FILE"`
Directory bool `help:"Allow directories selection" default:"false" env:"GUM_FILE_DIRECTORY"`
ShowHelp bool `help:"Show help key binds" negatable:"" default:"true" env:"GUM_FILE_SHOW_HELP"`
Height int `help:"Maximum number of files to display" default:"10" env:"GUM_FILE_HEIGHT"`
CursorStyle style.Styles `embed:"" prefix:"cursor." help:"The cursor style" set:"defaultForeground=212" envprefix:"GUM_FILE_CURSOR_"`