summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-11-03 13:23:05 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-11-03 13:23:05 -0300
commit121e9ebb3caa4f6259960fb66c6ede0bbc875666 (patch)
tree191292f7d1e8ce1631995ac1a41f2f336af7328b
parent5863c70d969c4654e0ea99f7b68876bc4aa5770b (diff)
Set terminal title with libremessages' term_title()
Useful for showing progress
-rwxr-xr-xlibremessages6
-rwxr-xr-xtreepkg7
2 files changed, 13 insertions, 0 deletions
diff --git a/libremessages b/libremessages
index 5d817dd..68badb8 100755
--- a/libremessages
+++ b/libremessages
@@ -86,6 +86,12 @@ stat_done() {
printf "${BOLD}done${ALL_OFF}\n" >&2
}
+# Set the terminal title
+# TODO test on several terms - it works on screen/tmux
+term_title() {
+ printf "\033k%s\033\\" "$@"
+}
+
# usage : in_array( $needle, $haystack )
in_array() {
[[ $2 ]] || return 1 # Not found
diff --git a/treepkg b/treepkg
index fb7eed1..8c4cc8e 100755
--- a/treepkg
+++ b/treepkg
@@ -18,12 +18,15 @@
source /etc/libretools.conf
source $XDG_CONFIG_HOME/libretools/libretools.conf >/dev/null 2>&1|| true
+term_title "$(basename $0)"
+
# Get system variables
source /etc/makepkg.conf
source $HOME/makepkg.conf >/dev/null 2>&1|| true
# End inmediately but print an useful message
trap_exit() {
+ term_title "error!"
error "($(basename $0)) $@ (leftovers on ${BUILDDIR})"
exit 1
}
@@ -201,6 +204,9 @@ if [ ${DEPTH} -eq 0 ]; then
${VERBOSE} && msg "Building ${_pkg/_/ }" || true
+# Remove leading zeros and space if any
+ term_title "$(echo ${_pkg/_/ } | sed "s/^0\+ \?//")"
+
# Run build command
pushd "${BUILDDIR}/${_pkg}" >/dev/null
sudo pacman -Syu --noconfirm
@@ -227,4 +233,5 @@ fi
fi
+term_title "done"
exit $?