mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-22 05:29:44 +02:00
rename prompt to input
This commit is contained in:
parent
5724fa534a
commit
8a59a4404b
@ -5,8 +5,10 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/fatih/color"
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands"
|
"github.com/jesseduffield/lazygit/pkg/commands"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CustomCommandObjects struct {
|
type CustomCommandObjects struct {
|
||||||
@ -92,7 +94,7 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand CustomCommand) func(
|
|||||||
wrappedF := f
|
wrappedF := f
|
||||||
|
|
||||||
switch prompt.Type {
|
switch prompt.Type {
|
||||||
case "prompt":
|
case "input":
|
||||||
f = func() error {
|
f = func() error {
|
||||||
title, err := gui.resolveTemplate(prompt.Title, promptResponses)
|
title, err := gui.resolveTemplate(prompt.Title, promptResponses)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -142,7 +144,7 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand CustomCommand) func(
|
|||||||
}
|
}
|
||||||
|
|
||||||
menuItems[i] = &menuItem{
|
menuItems[i] = &menuItem{
|
||||||
displayStrings: []string{name, description},
|
displayStrings: []string{name, utils.ColoredString(description, color.FgYellow)},
|
||||||
onPress: func() error {
|
onPress: func() error {
|
||||||
promptResponses[idx] = value
|
promptResponses[idx] = value
|
||||||
|
|
||||||
@ -159,7 +161,7 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand CustomCommand) func(
|
|||||||
return gui.createMenu(title, menuItems, createMenuOptions{showCancel: true})
|
return gui.createMenu(title, menuItems, createMenuOptions{showCancel: true})
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return gui.createErrorPanel("custom command prompt must have a type of 'prompt' or 'menu'")
|
return gui.createErrorPanel("custom command prompt must have a type of 'input' or 'menu'")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -175,7 +177,7 @@ type CustomCommandMenuOption struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CustomCommandPrompt struct {
|
type CustomCommandPrompt struct {
|
||||||
Type string `yaml:"type"` // one of 'prompt' and 'menu'
|
Type string `yaml:"type"` // one of 'input' and 'menu'
|
||||||
Title string `yaml:"title"`
|
Title string `yaml:"title"`
|
||||||
|
|
||||||
// this only apply to prompts
|
// this only apply to prompts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user