#!/bin/bash

LINES=${LINES:-25}
COLUMNS=${COLUMNS:-80}

# vv Customize this
Lines_In_Prompt=2

nobatch=$(condor_q -nobatch "$@")
if [[ $? -ne 0 ]]; then
    printf "%s\n" "$nobatch"
    exit $?
fi
if [[ $(<<<"$nobatch" fmt -sw"$COLUMNS" | wc -l) -gt $(( LINES - Lines_In_Prompt )) ]]; then
    exec condor_q -batch "$@"
else
    printf "%s\n" "$nobatch"
fi

