Set terminal title in readwwwlog
This commit is contained in:
parent
bb8fe8f958
commit
8b8010882b
|
@ -15,17 +15,22 @@ fi
|
|||
local -a urls=(${@})
|
||||
|
||||
local default_cmd="firefox"
|
||||
local termopts=""
|
||||
|
||||
for url in ${urls}; do
|
||||
if [[ ${url} =~ 'dpaste\.com' && ! ${url[-4,-1]} == ".txt" ]]; then
|
||||
url+=".txt"
|
||||
fi
|
||||
|
||||
if [[ ${TERMINAL} =~ "alacritty|xfce4-terminal" ]]; then
|
||||
termopts="--title=${url}"
|
||||
fi
|
||||
|
||||
if curl --silent --location --head ${url} | grep -q 'text/plain'; then
|
||||
sleep 1 # dpaste.com workaround
|
||||
local file="$(mktemp --suffix='.readwwwlog')"
|
||||
curl --silent --location --output ${file} ${url}
|
||||
${TERMINAL} -e less --LINE-NUMBERS --pattern='(error|fail):' ${file}
|
||||
${TERMINAL} ${termopts} -e less --LINE-NUMBERS --pattern='(error|fail):' ${file}
|
||||
rm ${file}
|
||||
else
|
||||
${default_cmd} ${url}
|
||||
|
|
Loading…
Reference in New Issue
Block a user