mirror of
https://github.com/charmbracelet/gum
synced 2024-06-08 00:32:17 +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"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/alecthomas/kong"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/gum/internal/stack"
|
"github.com/charmbracelet/gum/internal/stack"
|
||||||
|
"github.com/charmbracelet/gum/style"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Run is the interface to picking a file.
|
// Run is the interface to picking a file.
|
||||||
|
@ -56,3 +58,9 @@ func (o Options) Run() error {
|
||||||
|
|
||||||
return nil
|
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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/alecthomas/kong"
|
||||||
"github.com/charmbracelet/bubbles/viewport"
|
"github.com/charmbracelet/bubbles/viewport"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/gum/internal/stdin"
|
"github.com/charmbracelet/gum/internal/stdin"
|
||||||
|
"github.com/charmbracelet/gum/style"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Run provides a shell script interface for the viewport bubble.
|
// Run provides a shell script interface for the viewport bubble.
|
||||||
|
@ -39,3 +41,9 @@ func (o Options) Run() error {
|
||||||
}
|
}
|
||||||
return nil
|
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"`
|
Columns []string `short:"c" help:"Column names"`
|
||||||
Widths []int `short:"w" help:"Column widths"`
|
Widths []int `short:"w" help:"Column widths"`
|
||||||
Height int `help:"Table height" default:"10"`
|
Height int `help:"Table height" default:"10"`
|
||||||
CellStyle style.Styles `embed:"" prefix:"cell." envprefix:"GUM_TABLE_CELL"`
|
CellStyle style.Styles `embed:"" prefix:"cell." envprefix:"GUM_TABLE_CELL_"`
|
||||||
HeaderStyle style.Styles `embed:"" prefix:"header." envprefix:"GUM_TABLE_HEADER"`
|
HeaderStyle style.Styles `embed:"" prefix:"header." envprefix:"GUM_TABLE_HEADER_"`
|
||||||
SelectedStyle style.Styles `embed:"" prefix:"selected." set:"defaultForeground=212" envprefix:"GUM_TABLE_SELECTED"`
|
SelectedStyle style.Styles `embed:"" prefix:"selected." set:"defaultForeground=212" envprefix:"GUM_TABLE_SELECTED_"`
|
||||||
File string `short:"f" help:"file path" default:""`
|
File string `short:"f" help:"file path" default:""`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue