mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 03:24:54 +00:00
Add packages/cli-rs, an OpenCode client written in Rust on OpenTUI's Rust crates. It is a client only.
23 lines
877 B
TypeScript
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"),
|
|
},
|
|
],
|
|
}))
|
|
},
|
|
}
|