Skip to content

Commit

Permalink
Merge pull request #1472 from rsteube/gum-updated-0.9.0
Browse files Browse the repository at this point in the history
gum: updates from v0.9.0
  • Loading branch information
rsteube authored Jan 13, 2023
2 parents 770d472 + 5c28e27 commit 3b0efd2
Show file tree
Hide file tree
Showing 14 changed files with 621 additions and 56 deletions.
72 changes: 64 additions & 8 deletions completers/gum_completer/cmd/choose.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,82 @@ var chooseCmd = &cobra.Command{

func init() {
carapace.Gen(chooseCmd).Standalone()

chooseCmd.Flags().String("cursor", "", "Prefix to show on item that corresponds to the cursor position")
chooseCmd.Flags().String("cursor-prefix", "", "Prefix to show on the cursor item")
chooseCmd.Flags().String("cursor-prefix", "", "Prefix to show on the cursor item (hidden if limit is 1)")
chooseCmd.Flags().String("cursor.align", "", "Text Alignment")
chooseCmd.Flags().String("cursor.background", "", "Background Color")
chooseCmd.Flags().Bool("cursor.bold", false, "Bold text")
chooseCmd.Flags().String("cursor.border", "", "Border Style")
chooseCmd.Flags().String("cursor.border-background", "", "Border Background Color")
chooseCmd.Flags().String("cursor.border-foreground", "", "Border Foreground Color")
chooseCmd.Flags().Bool("cursor.faint", false, "Faint text")
chooseCmd.Flags().String("cursor.foreground", "", "Foreground Color")
chooseCmd.Flags().String("cursor.height", "", "Text height")
chooseCmd.Flags().Bool("cursor.italic", false, "Italicize text")
chooseCmd.Flags().String("cursor.margin", "", "Text margin")
chooseCmd.Flags().String("cursor.padding", "", "Text padding")
chooseCmd.Flags().Bool("cursor.strikethrough", false, "Strikethrough text")
chooseCmd.Flags().Bool("cursor.underline", false, "Underline text")
chooseCmd.Flags().String("cursor.width", "", "Text width")
chooseCmd.Flags().String("height", "", "Height of the list")
chooseCmd.Flags().String("item.align", "", "Text Alignment")
chooseCmd.Flags().String("item.background", "", "Background Color")
chooseCmd.Flags().Bool("item.bold", false, "Bold text")
chooseCmd.Flags().String("item.border", "", "Border Style")
chooseCmd.Flags().String("item.border-background", "", "Border Background Color")
chooseCmd.Flags().String("item.border-foreground", "", "Border Foreground Color")
chooseCmd.Flags().Bool("item.faint", false, "Faint text")
chooseCmd.Flags().String("item.foreground", "", "Foreground Color")
chooseCmd.Flags().String("item.height", "", "Text height")
chooseCmd.Flags().Bool("item.italic", false, "Italicize text")
chooseCmd.Flags().String("item.margin", "", "Text margin")
chooseCmd.Flags().String("item.padding", "", "Text padding")
chooseCmd.Flags().Bool("item.strikethrough", false, "Strikethrough text")
chooseCmd.Flags().Bool("item.underline", false, "Underline text")
chooseCmd.Flags().String("item.width", "", "Text width")
chooseCmd.Flags().String("limit", "", "Maximum number of options to pick")
chooseCmd.Flags().Bool("no-limit", false, "Pick unlimited number of options (ignores limit)")
chooseCmd.Flags().String("selected", "", "Options that should start as selected")
chooseCmd.Flags().String("selected-prefix", "", "Prefix to show on selected items")
chooseCmd.Flags().StringSlice("selected", []string{}, "Options that should start as selected")
chooseCmd.Flags().String("selected-prefix", "", "Prefix to show on selected items (hidden if limit is 1)")
chooseCmd.Flags().String("selected.align", "", "Text Alignment")
chooseCmd.Flags().String("selected.background", "", "Background Color")
chooseCmd.Flags().Bool("selected.bold", false, "Bold text")
chooseCmd.Flags().String("selected.border", "", "Border Style")
chooseCmd.Flags().String("selected.border-background", "", "Border Background Color")
chooseCmd.Flags().String("selected.border-foreground", "", "Border Foreground Color")
chooseCmd.Flags().Bool("selected.faint", false, "Faint text")
chooseCmd.Flags().String("selected.foreground", "", "Foreground Color")
chooseCmd.Flags().String("unselected-prefix", "", "Prefix to show on selected items")
chooseCmd.Flags().String("selected.height", "", "Text height")
chooseCmd.Flags().Bool("selected.italic", false, "Italicize text")
chooseCmd.Flags().String("selected.margin", "", "Text margin")
chooseCmd.Flags().String("selected.padding", "", "Text padding")
chooseCmd.Flags().Bool("selected.strikethrough", false, "Strikethrough text")
chooseCmd.Flags().Bool("selected.underline", false, "Underline text")
chooseCmd.Flags().String("selected.width", "", "Text width")
chooseCmd.Flags().String("unselected-prefix", "", "Prefix to show on unselected items (hidden if limit is 1)")
rootCmd.AddCommand(chooseCmd)

carapace.Gen(chooseCmd).FlagCompletion(carapace.ActionMap{
"cursor.foreground": gum.ActionColors(),
"item.foreground": gum.ActionColors(),
"cursor.align": gum.ActionAlignments(),
"cursor.background": gum.ActionColors(),
"cursor.border": gum.ActionBorders(),
"cursor.border-background": gum.ActionColors(),
"cursor.border-foreground": gum.ActionColors(),
"cursor.foreground": gum.ActionColors(),
"item.align": gum.ActionAlignments(),
"item.background": gum.ActionColors(),
"item.border": gum.ActionBorders(),
"item.border-background": gum.ActionColors(),
"item.border-foreground": gum.ActionColors(),
"item.foreground": gum.ActionColors(),
"selected": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return carapace.ActionValues(c.Args...).UniqueList(",")
}),
"selected.foreground": gum.ActionColors(),
"selected.align": gum.ActionAlignments(),
"selected.background": gum.ActionColors(),
"selected.border": gum.ActionBorders(),
"selected.border-background": gum.ActionColors(),
"selected.border-foreground": gum.ActionColors(),
"selected.foreground": gum.ActionColors(),
})
}
64 changes: 60 additions & 4 deletions completers/gum_completer/cmd/confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,75 @@ var confirmCmd = &cobra.Command{

func init() {
carapace.Gen(confirmCmd).Standalone()

confirmCmd.Flags().String("affirmative", "", "The title of the affirmative action")
confirmCmd.Flags().Bool("default", false, "Default confirmation action")
confirmCmd.Flags().String("negative", "", "The title of the negative action")
confirmCmd.Flags().String("prompt.align", "", "Text Alignment")
confirmCmd.Flags().String("prompt.background", "", "Background Color")
confirmCmd.Flags().Bool("prompt.bold", false, "Bold text")
confirmCmd.Flags().String("prompt.border", "", "Border Style")
confirmCmd.Flags().String("prompt.border-background", "", "Border Background Color")
confirmCmd.Flags().String("prompt.border-foreground", "", "Border Foreground Color")
confirmCmd.Flags().Bool("prompt.faint", false, "Faint text")
confirmCmd.Flags().String("prompt.foreground", "", "Foreground Color")
confirmCmd.Flags().String("prompt.height", "", "Text height")
confirmCmd.Flags().Bool("prompt.italic", false, "Italicize text")
confirmCmd.Flags().String("prompt.margin", "", "Text margin")
confirmCmd.Flags().String("prompt.padding", "", "Text padding")
confirmCmd.Flags().Bool("prompt.strikethrough", false, "Strikethrough text")
confirmCmd.Flags().Bool("prompt.underline", false, "Underline text")
confirmCmd.Flags().String("prompt.width", "", "Text width")
confirmCmd.Flags().String("selected.align", "", "Text Alignment")
confirmCmd.Flags().String("selected.background", "", "Background Color")
confirmCmd.Flags().Bool("selected.bold", false, "Bold text")
confirmCmd.Flags().String("selected.border", "", "Border Style")
confirmCmd.Flags().String("selected.border-background", "", "Border Background Color")
confirmCmd.Flags().String("selected.border-foreground", "", "Border Foreground Color")
confirmCmd.Flags().Bool("selected.faint", false, "Faint text")
confirmCmd.Flags().String("selected.foreground", "", "Foreground Color")
confirmCmd.Flags().String("selected.height", "", "Text height")
confirmCmd.Flags().Bool("selected.italic", false, "Italicize text")
confirmCmd.Flags().String("selected.margin", "", "Text margin")
confirmCmd.Flags().String("selected.padding", "", "Text padding")
confirmCmd.Flags().Bool("selected.strikethrough", false, "Strikethrough text")
confirmCmd.Flags().Bool("selected.underline", false, "Underline text")
confirmCmd.Flags().String("selected.width", "", "Text width")
confirmCmd.Flags().String("timeout", "", "Timeout for confirmation")
confirmCmd.Flags().String("unselected.align", "", "Text Alignment")
confirmCmd.Flags().String("unselected.background", "", "Background Color")
confirmCmd.Flags().Bool("unselected.bold", false, "Bold text")
confirmCmd.Flags().String("unselected.border", "", "Border Style")
confirmCmd.Flags().String("unselected.border-background", "", "Border Background Color")
confirmCmd.Flags().String("unselected.border-foreground", "", "Border Foreground Color")
confirmCmd.Flags().Bool("unselected.faint", false, "Faint text")
confirmCmd.Flags().String("unselected.foreground", "", "Foreground Color")
confirmCmd.Flags().String("unselected.height", "", "Text height")
confirmCmd.Flags().Bool("unselected.italic", false, "Italicize text")
confirmCmd.Flags().String("unselected.margin", "", "Text margin")
confirmCmd.Flags().String("unselected.padding", "", "Text padding")
confirmCmd.Flags().Bool("unselected.strikethrough", false, "Strikethrough text")
confirmCmd.Flags().Bool("unselected.underline", false, "Underline text")
confirmCmd.Flags().String("unselected.width", "", "Text width")
rootCmd.AddCommand(confirmCmd)

carapace.Gen(confirmCmd).FlagCompletion(carapace.ActionMap{
"prompt.foreground": gum.ActionColors(),
"selected.foreground": gum.ActionColors(),
"unselected.foreground": gum.ActionColors(),
"prompt.align": gum.ActionAlignments(),
"prompt.background": gum.ActionColors(),
"prompt.border": gum.ActionBorders(),
"prompt.border-background": gum.ActionColors(),
"prompt.border-foreground": gum.ActionColors(),
"prompt.foreground": gum.ActionColors(),
"selected.align": gum.ActionAlignments(),
"selected.background": gum.ActionColors(),
"selected.border": gum.ActionBorders(),
"selected.border-background": gum.ActionColors(),
"selected.border-foreground": gum.ActionColors(),
"selected.foreground": gum.ActionColors(),
"unselected.align": gum.ActionAlignments(),
"unselected.background": gum.ActionColors(),
"unselected.border": gum.ActionBorders(),
"unselected.border-background": gum.ActionColors(),
"unselected.border-foreground": gum.ActionColors(),
"unselected.foreground": gum.ActionColors(),
})
}
3 changes: 2 additions & 1 deletion completers/gum_completer/cmd/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ var fileCmd = &cobra.Command{

func init() {
carapace.Gen(fileCmd).Standalone()

fileCmd.Flags().BoolP("all", "a", false, "Show hidden and 'dot' files")
fileCmd.Flags().StringP("cursor", "c", "", "The cursor character")
fileCmd.Flags().String("cursor.align", "", "Text Alignment")
Expand All @@ -32,6 +31,7 @@ func init() {
fileCmd.Flags().Bool("cursor.strikethrough", false, "Strikethrough text")
fileCmd.Flags().Bool("cursor.underline", false, "Underline text")
fileCmd.Flags().String("cursor.width", "", "Text width")
fileCmd.Flags().Bool("directory", false, "Allow directories selection")
fileCmd.Flags().String("directory.align", "", "Text Alignment")
fileCmd.Flags().String("directory.background", "", "Background Color")
fileCmd.Flags().Bool("directory.bold", false, "Bold text")
Expand All @@ -47,6 +47,7 @@ func init() {
fileCmd.Flags().Bool("directory.strikethrough", false, "Strikethrough text")
fileCmd.Flags().Bool("directory.underline", false, "Underline text")
fileCmd.Flags().String("directory.width", "", "Text width")
fileCmd.Flags().Bool("file", false, "Allow files selection")
fileCmd.Flags().String("file-size.align", "", "Text Alignment")
fileCmd.Flags().String("file-size.background", "", "Background Color")
fileCmd.Flags().Bool("file-size.bold", false, "Bold text")
Expand Down
Loading

0 comments on commit 3b0efd2

Please sign in to comment.