mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-15 21:14:35 +02:00
Start work on porting themes kitten to Go
This commit is contained in:
@@ -4,11 +4,10 @@ package completion
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"kitty/tools/cli"
|
||||
"kitty/tools/utils"
|
||||
"kitty/tools/themes"
|
||||
)
|
||||
|
||||
var _ = fmt.Print
|
||||
@@ -64,20 +63,7 @@ func complete_plus_open(completions *cli.Completions, word string, arg_num int)
|
||||
}
|
||||
|
||||
func complete_themes(completions *cli.Completions, word string, arg_num int) {
|
||||
kitty := utils.KittyExe()
|
||||
if kitty != "" {
|
||||
out, err := exec.Command(kitty, "+runpy", "from kittens.themes.collection import *; print_theme_names()").Output()
|
||||
if err == nil {
|
||||
mg := completions.AddMatchGroup("Themes")
|
||||
scanner := utils.NewLineScanner(utils.UnsafeBytesToString(out))
|
||||
for scanner.Scan() {
|
||||
theme_name := strings.TrimSpace(scanner.Text())
|
||||
if theme_name != "" && strings.HasPrefix(theme_name, word) {
|
||||
mg.AddMatch(theme_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
themes.CompleteThemes(completions, word, arg_num)
|
||||
}
|
||||
|
||||
func EntryPoint(tool_root *cli.Command) {
|
||||
|
||||
Reference in New Issue
Block a user