mirror of
https://github.com/charmbracelet/gum
synced 2024-06-13 11:12:19 +02:00
refactor: remove unneeded set:"name="
This commit is contained in:
parent
06e8546366
commit
bba0f3b1e0
|
@ -14,7 +14,7 @@ type Options struct {
|
||||||
CursorPrefix string `help:"Prefix to show on the cursor item (hidden if limit is 1)" default:"[•] "`
|
CursorPrefix string `help:"Prefix to show on the cursor item (hidden if limit is 1)" default:"[•] "`
|
||||||
SelectedPrefix string `help:"Prefix to show on selected items (hidden if limit is 1)" default:"[✕] "`
|
SelectedPrefix string `help:"Prefix to show on selected items (hidden if limit is 1)" default:"[✕] "`
|
||||||
UnselectedPrefix string `help:"Prefix to show on selected items (hidden if limit is 1)" default:"[ ] "`
|
UnselectedPrefix string `help:"Prefix to show on selected items (hidden if limit is 1)" default:"[ ] "`
|
||||||
CursorStyle style.Styles `embed:"" prefix:"cursor." set:"defaultForeground=212" set:"name=indicator"`
|
CursorStyle style.Styles `embed:"" prefix:"cursor." set:"defaultForeground=212"`
|
||||||
ItemStyle style.Styles `embed:"" prefix:"item." hidden:"" set:"defaultForeground=255" set:"name=item"`
|
ItemStyle style.Styles `embed:"" prefix:"item." hidden:""`
|
||||||
SelectedItemStyle style.Styles `embed:"" prefix:"selected." set:"defaultForeground=212" set:"name=selected item"`
|
SelectedItemStyle style.Styles `embed:"" prefix:"selected." set:"defaultForeground=212"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,9 @@ package confirm
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/alecthomas/kong"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
|
"github.com/charmbracelet/gum/style"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Run provides a shell script interface for prompting a user to confirm an
|
// Run provides a shell script interface for prompting a user to confirm an
|
||||||
|
@ -31,3 +33,8 @@ func (o Options) Run() error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BeforeReset hook. Used to unclutter style flags.
|
||||||
|
func (o Options) BeforeReset(ctx *kong.Context) error {
|
||||||
|
return style.HideFlags(ctx)
|
||||||
|
}
|
||||||
|
|
|
@ -6,12 +6,12 @@ import "github.com/charmbracelet/gum/style"
|
||||||
// nolint:staticcheck
|
// nolint:staticcheck
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Indicator string `help:"Character for selection" default:"•"`
|
Indicator string `help:"Character for selection" default:"•"`
|
||||||
IndicatorStyle style.Styles `embed:"" prefix:"indicator." set:"defaultForeground=212" set:"name=indicator"`
|
IndicatorStyle style.Styles `embed:"" prefix:"indicator." set:"defaultForeground=212"`
|
||||||
TextStyle style.Styles `embed:"" prefix:"text."`
|
TextStyle style.Styles `embed:"" prefix:"text."`
|
||||||
MatchStyle style.Styles `embed:"" prefix:"match." set:"defaultForeground=212" set:"name=matched text"`
|
MatchStyle style.Styles `embed:"" prefix:"match." set:"defaultForeground=212"`
|
||||||
Placeholder string `help:"Placeholder value" default:"Filter..."`
|
Placeholder string `help:"Placeholder value" default:"Filter..."`
|
||||||
Prompt string `help:"Prompt to display" default:"> "`
|
Prompt string `help:"Prompt to display" default:"> "`
|
||||||
PromptStyle style.Styles `embed:"" prefix:"prompt." set:"defaultForeground=240" set:"name=prompt"`
|
PromptStyle style.Styles `embed:"" prefix:"prompt." set:"defaultForeground=240"`
|
||||||
Width int `help:"Input width" default:"20"`
|
Width int `help:"Input width" default:"20"`
|
||||||
Height int `help:"Input height" default:"0"`
|
Height int `help:"Input height" default:"0"`
|
||||||
}
|
}
|
||||||
|
|
6
gum.go
6
gum.go
|
@ -18,13 +18,13 @@ import (
|
||||||
// Gum is the command-line interface for Gum.
|
// Gum is the command-line interface for Gum.
|
||||||
type Gum struct {
|
type Gum struct {
|
||||||
// Version is a flag that can be used to display the version number.
|
// Version is a flag that can be used to display the version number.
|
||||||
Version kong.VersionFlag `short:"v" help:"Print the version number"`
|
Version kong.VersionFlag `short:"v" help:"Print the version number" env:"-"`
|
||||||
|
|
||||||
// Completion generates Gum shell completion scripts.
|
// Completion generates Gum shell completion scripts.
|
||||||
Completion completion.Completion `cmd:"" hidden:"" help:"Request shell completion"`
|
Completion completion.Completion `cmd:"" hidden:"" help:"Request shell completion" env:"-"`
|
||||||
|
|
||||||
// Man is a hidden command that generates Gum man pages.
|
// Man is a hidden command that generates Gum man pages.
|
||||||
Man man.Man `cmd:"" hidden:"" help:"Generate man pages"`
|
Man man.Man `cmd:"" hidden:"" help:"Generate man pages" env:"-"`
|
||||||
|
|
||||||
// Choose provides an interface to choose one option from a given list of
|
// Choose provides an interface to choose one option from a given list of
|
||||||
// options. The options can be provided as (new-line separated) stdin or a
|
// options. The options can be provided as (new-line separated) stdin or a
|
||||||
|
|
|
@ -7,8 +7,8 @@ import "github.com/charmbracelet/gum/style"
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Placeholder string `help:"Placeholder value" default:"Type something..."`
|
Placeholder string `help:"Placeholder value" default:"Type something..."`
|
||||||
Prompt string `help:"Prompt to display" default:"> "`
|
Prompt string `help:"Prompt to display" default:"> "`
|
||||||
PromptStyle style.Styles `embed:"" prefix:"prompt." set:"name=prompt"`
|
PromptStyle style.Styles `embed:"" prefix:"prompt."`
|
||||||
CursorStyle style.Styles `embed:"" prefix:"cursor." set:"defaultForeground=212" set:"name=cursor"`
|
CursorStyle style.Styles `embed:"" prefix:"cursor." set:"defaultForeground=212"`
|
||||||
Value string `help:"Initial value (can also be passed via stdin)" default:""`
|
Value string `help:"Initial value (can also be passed via stdin)" default:""`
|
||||||
CharLimit int `help:"Maximum value length (0 for no limit)" default:"400"`
|
CharLimit int `help:"Maximum value length (0 for no limit)" default:"400"`
|
||||||
Width int `help:"Input width" default:"40"`
|
Width int `help:"Input width" default:"40"`
|
||||||
|
|
|
@ -7,9 +7,9 @@ import "github.com/charmbracelet/gum/style"
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Command []string `arg:"" help:"Command to run"`
|
Command []string `arg:"" help:"Command to run"`
|
||||||
|
|
||||||
Spinner string `help:"Spinner type" short:"s" type:"spinner" enum:"line,dot,minidot,jump,pulse,points,globe,moon,monkey,meter,hamburger" default:"dot"`
|
|
||||||
SpinnerStyle style.Styles `embed:"" prefix:"spinner." set:"defaultForeground=212" set:"name=spinner"`
|
|
||||||
Title string `help:"Text to display to user while spinning" default:"Loading..."`
|
|
||||||
TitleStyle style.Styles `embed:"" prefix:"title." set:"name=title"`
|
|
||||||
ShowOutput bool `help:"Show output of command" default:"false"`
|
ShowOutput bool `help:"Show output of command" default:"false"`
|
||||||
|
Spinner string `help:"Spinner type" short:"s" type:"spinner" enum:"line,dot,minidot,jump,pulse,points,globe,moon,monkey,meter,hamburger" default:"dot"`
|
||||||
|
SpinnerStyle style.Styles `embed:"" prefix:"spinner." set:"defaultForeground=212"`
|
||||||
|
Title string `help:"Text to display to user while spinning" default:"Loading..."`
|
||||||
|
TitleStyle style.Styles `embed:"" prefix:"title."`
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ type Options struct {
|
||||||
Value string `help:"Initial value (can be passed via stdin)" default:""`
|
Value string `help:"Initial value (can be passed via stdin)" default:""`
|
||||||
CharLimit int `help:"Maximum value length (0 for no limit)" default:"400"`
|
CharLimit int `help:"Maximum value length (0 for no limit)" default:"400"`
|
||||||
|
|
||||||
BaseStyle style.Styles `embed:"" prefix:"base." set:"name=base"`
|
BaseStyle style.Styles `embed:"" prefix:"base."`
|
||||||
CursorLineNumberStyle style.Styles `embed:"" prefix:"cursor-line-number." set:"defaultForeground=7" set:"name=cursor line number"`
|
CursorLineNumberStyle style.Styles `embed:"" prefix:"cursor-line-number." set:"defaultForeground=7"`
|
||||||
CursorLineStyle style.Styles `embed:"" prefix:"cursor-line." set:"name=cursor line"`
|
CursorLineStyle style.Styles `embed:"" prefix:"cursor-line."`
|
||||||
CursorStyle style.Styles `embed:"" prefix:"cursor." set:"defaultForeground=212" set:"name=cursor"`
|
CursorStyle style.Styles `embed:"" prefix:"cursor." set:"defaultForeground=212"`
|
||||||
EndOfBufferStyle style.Styles `embed:"" prefix:"end-of-buffer." set:"defaultForeground=0" set:"name=end of buffer"`
|
EndOfBufferStyle style.Styles `embed:"" prefix:"end-of-buffer." set:"defaultForeground=0"`
|
||||||
LineNumberStyle style.Styles `embed:"" prefix:"line-number." set:"defaultForeground=7" set:"name=line number"`
|
LineNumberStyle style.Styles `embed:"" prefix:"line-number." set:"defaultForeground=7"`
|
||||||
PlaceholderStyle style.Styles `embed:"" prefix:"placeholder." set:"defaultForeground=240" set:"name=placeholder"`
|
PlaceholderStyle style.Styles `embed:"" prefix:"placeholder." set:"defaultForeground=240"`
|
||||||
PromptStyle style.Styles `embed:"" prefix:"prompt." set:"defaultForeground=7" set:"name=prompt"`
|
PromptStyle style.Styles `embed:"" prefix:"prompt." set:"defaultForeground=7"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue