diff --git a/dot_local/bin/executable_pj b/dot_local/bin/executable_pj index 8bb05d1..a563670 100755 --- a/dot_local/bin/executable_pj +++ b/dot_local/bin/executable_pj @@ -16,6 +16,10 @@ # Env: # PJ_QUIET=1 suppress the "no task sources" error — the down-arrow # bindings use this, where an empty tree is the normal case. +# PJ_STATE=FILE key bindings pass a path; pj writes `open` to it when the +# picker opens and `pj --run` writes `ran`, so the binding +# can tell "no tasks" / "cancelled" / "task printed output" +# apart and redraw the prompt accordingly (tv --inline). # # Cable entry points (tab-separated record fields, see `--list`): # pj --list print one record per task @@ -150,6 +154,8 @@ fi if [ "${1-}" = --run ]; then kind=${2-} target=${3-} root=${4-} runner=${5-} cd "$root" || exit 1 + # Tell the key binding a task ran (its output now sits below the prompt). + [ -n "${PJ_STATE-}" ] && echo ran >"$PJ_STATE" # Extra args from `pj a b …`, shell-quoted into $PJ_EXTRA by the picker. extra=() @@ -440,4 +446,5 @@ if [ $# -gt 0 ]; then PJ_EXTRA=$(printf '%q ' "$@") export PJ_EXTRA fi -tv pj --source-command "cat '$tmp'" --input-header "$primary" +[ -n "${PJ_STATE-}" ] && echo open >"$PJ_STATE" +tv pj --inline --source-command "cat '$tmp'" --input-header "$primary"