* usr/bin/byobu-status:

- performance improvement, testing for directory existence before
    mkdir -p saves time
  - localize a couple of function variables
This commit is contained in:
Dustin Kirkland 2012-03-19 06:35:58 -05:00
commit 81e8d49c62
2 changed files with 11 additions and 7 deletions

5
debian/changelog vendored
View file

@ -1,6 +1,9 @@
byobu (5.17) unreleased; urgency=low byobu (5.17) unreleased; urgency=low
* UNRELEASED * usr/bin/byobu-status:
- performance improvement, testing for directory existence before
mkdir -p saves time
- localize a couple of function variables
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 11 Mar 2012 07:23:06 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Sun, 11 Mar 2012 07:23:06 -0500

View file

@ -27,7 +27,8 @@ PKG="byobu"
[ -f "$BYOBU_CONFIG_DIR/status.disable" ] && exit 0 [ -f "$BYOBU_CONFIG_DIR/status.disable" ] && exit 0
# Clean and create cache directories # Clean and create cache directories
mkdir -p "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND" "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND" [ -d "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND"
[ -d "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND"
# Source configurations # Source configurations
for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color" "$BYOBU_CONFIG_DIR/color.tmux"; do for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color" "$BYOBU_CONFIG_DIR/color.tmux"; do
@ -66,15 +67,15 @@ get_status() {
[ -r "$lastpath" ] && read lastrun < "$lastpath" [ -r "$lastpath" ] && read lastrun < "$lastpath"
case "$1" in case "$1" in
ip_address4) ip_address4)
IPV6=0 local IPV6=0
function="ip_address" local function="ip_address"
;; ;;
ip_address6) ip_address6)
IPV6=1 local IPV6=1
function="ip_address" local function="ip_address"
;; ;;
*) *)
function="$1" local function="$1"
;; ;;
esac esac
status_freq "$function" status_freq "$function"