git://git.nikiroo.be
/
gofetch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gopher.sh: disabling the escape sequences with ENV
[gofetch.git]
/
gopher.sh
diff --git
a/gopher.sh
b/gopher.sh
index 93715fca3de805898818f472c72df10af51e81a2..0042756538be4be9758e701ce79fe04c462b2b0a 100755
(executable)
--- a/
gopher.sh
+++ b/
gopher.sh
@@
-1,5
+1,12
@@
#!/bin/sh
#!/bin/sh
+# ENV variables:
+# LINK_COLOR: escape sequences colour (def: 2)
+# - : means no escape sequence
+# 1 : means colour 1
+# 2 : means colour 2
+# [...]
+
SERVER="$1"
SELECTOR="$2"
PORT="$3"
SERVER="$1"
SELECTOR="$2"
PORT="$3"
@@
-18,12
+25,13
@@
if [ "$SERVER" = "" ]; then
exit 2
fi
exit 2
fi
-LINK_COLOR=2 # can be empty for no escape sequences
+# can be "-" for no escape sequences
+[ "$LINK_COLOR" = "" ] && LINK_COLOR=2
# Start and end link tags
SL=
EL=
# Start and end link tags
SL=
EL=
-if [ "$LINK_COLOR" != "" ]; then
+if [ "$LINK_COLOR" != "
-
" ]; then
SL="`tput setf $LINK_COLOR``tput setaf $LINK_COLOR`"
EL="`tput init`";
fi
SL="`tput setf $LINK_COLOR``tput setaf $LINK_COLOR`"
EL="`tput init`";
fi
@@
-66,7
+74,7
@@
getsel() {
cat "$1" | grep '^[0-9]' | tail -n+"$2" | head -n 1 | cut -f"$3"
}
cat "$1" | grep '^[0-9]' | tail -n+"$2" | head -n 1 | cut -f"$3"
}
-tmp="`mktemp
gofetch.current_page.
XXXXX`"
+tmp="`mktemp
-t gofetch.current_page.X
XXXXX`"
finish() {
rm -rf "$tmp"
}
finish() {
rm -rf "$tmp"
}