Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Build a status line row of your own

When the default row shows more or less than you want, build a row of your own from the JSON fields of smllm statusline. You read the fields with jq and print the row with printf.

Before you begin

Steps

  1. Read the fields of the session into a variable, in your status line script:

    s=$(printf '%s' "$input" | smllm statusline --json)
    

    $input is the status JSON that your script read from stdin. The status line row lists each field.

  2. Print the row from the fields. This row shows only the state, in bold yellow:

    state=$(jq -r '.state // empty' <<<"$s")
    if [ -n "$state" ]; then printf '\n\033[1;33m%s\033[0m' "$state"; fi
    

    This one puts the state and the instance on the same row as your other fields, and shows nothing when the session is idle:

    where=$(jq -r 'select(.state) | "\(.state) \(.instance.label)"' <<<"$s")
    printf '%s%s' "$my_other_fields" "${where:+ | $where}"
    

    This one shows a warning colour while the agent has yielded:

    if [ "$(jq -r '.yielded' <<<"$s")" = true ]; then
      printf '\n\033[43;30m waiting for you \033[0m'
    fi
    

See also