mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-27 03:42:49 +00:00
Start work on porting themes kitten to Go
This commit is contained in:
parent
3741d3d1be
commit
f9b0b54ee5
7 changed files with 508 additions and 24 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue