feat(selector): add prompt to rofi/wofi
This commit is contained in:
parent
1a22fa442f
commit
f5ed53d378
2 changed files with 5 additions and 5 deletions
4
main.go
4
main.go
|
@ -65,7 +65,7 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
selection, err := selector(history, *maxPicker, *pickTool)
|
selection, err := selector(history, *maxPicker, *pickTool, "pick")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
selection, err := selector(history, *maxClearer, *clearTool)
|
selection, err := selector(history, *maxClearer, *clearTool, "clear")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func selector(data []string, max int, tool string) (string, error) {
|
func selector(data []string, max int, tool string, prompt string) (string, error) {
|
||||||
if len(data) == 0 {
|
if len(data) == 0 {
|
||||||
return "", errors.New("nothing to show: no data available")
|
return "", errors.New("nothing to show: no data available")
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,11 @@ func selector(data []string, max int, tool string) (string, error) {
|
||||||
"-l",
|
"-l",
|
||||||
strconv.Itoa(max)}
|
strconv.Itoa(max)}
|
||||||
case "rofi":
|
case "rofi":
|
||||||
args = []string{"rofi", "-dmenu",
|
args = []string{"rofi", "-p", prompt, "-dmenu",
|
||||||
"-lines",
|
"-lines",
|
||||||
strconv.Itoa(max)}
|
strconv.Itoa(max)}
|
||||||
case "wofi":
|
case "wofi":
|
||||||
args = []string{"wofi", "--cache-file", "/dev/null", "--dmenu"}
|
args = []string{"wofi", "-p", prompt, "--cache-file", "/dev/null", "--dmenu"}
|
||||||
default:
|
default:
|
||||||
return "", fmt.Errorf("Unsupported tool: %s", tool)
|
return "", fmt.Errorf("Unsupported tool: %s", tool)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue