opencode/packages/cli-rs/parity/plugins/title/tui.ts
Simon Klee 6b1df0cceb
feat(cli-rs): add the native CLI and TUI (#63477)
Add packages/cli-rs, an OpenCode client written in Rust on OpenTUI's Rust crates. It is a client only.
2026-11-22 00:07:01 +01:00

23 lines
877 B
TypeScript

// The P0b title plugin, TypeScript side: `/p0btitle` sets the terminal title, as an npm plugin does with
// `renderer.setTerminalTitle`. parity/scenarios/P.0b/fixture.ts installs this file and its opencode-native twin, the
// Luau plugin beside it (`Host:setTitle`), in one `plugins` directory: TS loads `tui.ts`, Rust loads `init.luau`.
import type { Context } from "../../../../plugin/src/tui/plugin"
export default {
id: "parity.title",
setup(context: Context) {
// Global, as the TS built-ins' commands are and as Rust registers a plugin's commands.
context.keymap.layer(() => ({
mode: "global",
commands: [
{
id: "p0b.title",
title: "Set the title",
palette: true,
slash: { name: "p0btitle" },
run: () => context.renderer.setTerminalTitle("p0b title"),
},
],
}))
},
}