mirror of
https://github.com/charmbracelet/gum
synced 2024-05-17 21:56:42 +02:00
fix(table): hide extra style flags + fix envprefix
This commit is contained in:
parent
2c66222fd8
commit
844727f185
|
@ -5,8 +5,10 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/alecthomas/kong"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/gum/internal/stack"
|
||||
"github.com/charmbracelet/gum/style"
|
||||
)
|
||||
|
||||
// Run is the interface to picking a file.
|
||||
|
@ -56,3 +58,9 @@ func (o Options) Run() error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// BeforeReset hook. Used to unclutter style flags.
|
||||
func (o Options) BeforeReset(ctx *kong.Context) error {
|
||||
style.HideFlags(ctx)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package pager
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/alecthomas/kong"
|
||||
"github.com/charmbracelet/bubbles/viewport"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/gum/internal/stdin"
|
||||
"github.com/charmbracelet/gum/style"
|
||||
)
|
||||
|
||||
// Run provides a shell script interface for the viewport bubble.
|
||||
|
@ -39,3 +41,9 @@ func (o Options) Run() error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// BeforeReset hook. Used to unclutter style flags.
|
||||
func (o Options) BeforeReset(ctx *kong.Context) error {
|
||||
style.HideFlags(ctx)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ type Options struct {
|
|||
Columns []string `short:"c" help:"Column names"`
|
||||
Widths []int `short:"w" help:"Column widths"`
|
||||
Height int `help:"Table height" default:"10"`
|
||||
CellStyle style.Styles `embed:"" prefix:"cell." envprefix:"GUM_TABLE_CELL"`
|
||||
HeaderStyle style.Styles `embed:"" prefix:"header." envprefix:"GUM_TABLE_HEADER"`
|
||||
SelectedStyle style.Styles `embed:"" prefix:"selected." set:"defaultForeground=212" envprefix:"GUM_TABLE_SELECTED"`
|
||||
CellStyle style.Styles `embed:"" prefix:"cell." envprefix:"GUM_TABLE_CELL_"`
|
||||
HeaderStyle style.Styles `embed:"" prefix:"header." envprefix:"GUM_TABLE_HEADER_"`
|
||||
SelectedStyle style.Styles `embed:"" prefix:"selected." set:"defaultForeground=212" envprefix:"GUM_TABLE_SELECTED_"`
|
||||
File string `short:"f" help:"file path" default:""`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue