Files
dotfiles/dot_config/fish/functions/_agents_bind.fish
T

13 lines
552 B
Fish

function _agents_bind --description 'ctrl-a: pick an AI agent (tv agents --inline) and start it, then redraw the prompt'
# The cable's launch action writes `ran` to $AGENTS_STATE before exec'ing
# the agent. Cancelled: tv left the cursor on the line below the prompt, so
# step back up; ran: the prompt goes wherever the agent left the cursor.
set -lx AGENTS_STATE (mktemp)
tv agents --inline
if test "$(cat $AGENTS_STATE)" != ran
printf '\033[A' >/dev/tty
end
rm -f $AGENTS_STATE
commandline -f repaint
end