From 3f8e3c28b375ff7be7948aff4e93d589d2225a67 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 26 Oct 2013 11:49:34 -0400 Subject: [PATCH] Clean up functions loader and util functions --- zsh/functions | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/zsh/functions b/zsh/functions index 64ed4ea4..ef1ade28 100644 --- a/zsh/functions +++ b/zsh/functions @@ -1,7 +1,13 @@ -# Open a file in Mac OS's quick-look -function quicklook { - (( $# > 0 )) && qlmanage -p $* &>/dev/null & +# Check to see if a command exists +function command_exists { + command -v "$1" &> /dev/null +} + +# Ask for admin password up front and keep sudo alive until the end of the script +function keep_alive { + sudo -v + while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & } # Extract a compressed file with the appropriate command @@ -26,8 +32,6 @@ function unpack { } # Source library -source ~/.zsh/lib/util -source ~/.zsh/lib/output -source ~/.zsh/lib/os +for f in ~/.zsh/lib/*; do source "$f"; done # vim:set ft=zsh: