Prevent invocation of command-palette from command line

This commit is contained in:
Kovid Goyal
2026-03-03 13:13:20 +05:30
parent 347c829156
commit 4ec1fa5168
2 changed files with 5 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import (
"github.com/kovidgoyal/kitty/tools/cli"
"github.com/kovidgoyal/kitty/tools/fzf"
"github.com/kovidgoyal/kitty/tools/tty"
"github.com/kovidgoyal/kitty/tools/tui"
"github.com/kovidgoyal/kitty/tools/tui/loop"
"github.com/kovidgoyal/kitty/tools/wcswidth"
@@ -621,6 +622,9 @@ func (h *Handler) triggerSelected() {
}
func main(cmd *cli.Command, opts *Options, args []string) (rc int, err error) {
if tty.IsTerminal(os.Stdin.Fd()) {
return 1, fmt.Errorf("This kitten must only be run via a mapping in kitty.conf")
}
output := tui.KittenOutputSerializer()
lp, err := loop.New()
if err != nil {

View File

@@ -119,7 +119,7 @@ def collect_keys_data(opts: Any) -> dict[str, Any]:
def main(args: list[str]) -> None:
raise SystemExit('This must be run as kitten command-palette')
raise SystemExit('This kitten must be used only from a kitty.conf mapping')
@result_handler(has_ready_notification=True)