From d3b28cbf09f526d7f9938b407486885e4cc9c005 Mon Sep 17 00:00:00 2001 From: Alexander Meshcheryakov Date: Fri, 14 Dec 2018 00:34:07 +0300 Subject: [PATCH] Handle narrow terminals in sample bash function Also allow compression of server response --- share/bash-function.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/bash-function.txt b/share/bash-function.txt index c573c95..f3cda23 100644 --- a/share/bash-function.txt +++ b/share/bash-function.txt @@ -1,5 +1,7 @@ wttr() { # change Paris to your default location - curl -H "Accept-Language: ${LANG%_*}" wttr.in/"${1:-Paris}" + local request="wttr.in/${1:-Paris}" + [ "$COLUMNS" -lt 125 ] && request+='?n' + curl -H "Accept-Language: ${LANG%_*}" --compressed "$request" }