mirror of
https://github.com/charmbracelet/gum
synced 2026-03-14 13:45:45 +01:00
Show help with Huh? (#587)
* chore(deps): bump deps * feat: show help using huh? * fix: lint * fix: test.sh
This commit is contained in:
parent
00767d209a
commit
a8712df2a7
15 changed files with 95 additions and 67 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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_"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue