Convenience function to get terminfo data in kittens

This commit is contained in:
Kovid Goyal
2024-03-21 10:58:46 +05:30
parent 198b69e275
commit 924b87a16a
2 changed files with 8 additions and 1 deletions

View File

@@ -23,6 +23,12 @@ var _ = fmt.Print
type integration_setup_func = func(shell_integration_dir string, argv []string, env map[string]string) ([]string, map[string]string, error)
func TerminfoData() string {
d := Data()
entry := d["terminfo/x/xterm-kitty"]
return utils.UnsafeBytesToString(entry.Data)
}
func extract_files(match, dest_dir string) (err error) {
d := Data()
for _, fname := range d.FilesMatching(match) {

View File

@@ -29,7 +29,7 @@ func TestExtractShellIntegration(t *testing.T) {
if err != nil {
t.Fatal(err)
}
os.WriteFile(kzsh, []byte("changed"), 0o644)
_ = os.WriteFile(kzsh, []byte("changed"), 0o644)
if err := extract_shell_integration_for("zsh", tdir); err != nil {
t.Fatal(err)
}
@@ -47,4 +47,5 @@ func TestExtractShellIntegration(t *testing.T) {
if _, err := os.Stat(filepath.Join(tdir, "terminfo", "78", kitty.DefaultTermName)); err != nil {
t.Fatal(err)
}
TerminfoData()
}