# FUNCTIONS - SH
#
#################################################################################
+shell_help() {
+ #
+ # Print help message and return true if args contains -?-h(elp)?
+ #
+ local msg="$1"; shift
+
+ case "$@" in
+ *-h*|*-help*|*--help*)
+ case $OSTYPE in
+ darwin*) printf "$msg\n" ;;
+ *) echo -e "$msg" ;;
+ esac
+ return 0
+ ;;
+ *) return 1 ;;
+ esac
+
+}
+
+shell_help_noarg() {
+ #
+ # Print help message and return true if args contains -?-h(elp)? or is empty
+ #
+ local msg="$1"; shift
+
+ local args=""; args="$@" # zsh compatible
+ [ -z "$args" ] && args="--help"
+
+ sem_help "$msg" "$args"
+}
+
shell_functions() {
set | perl -ne '/^([a-z][\w_-]+) \(\)\s*$/ and print "$1\n"'
}
+mac_pbcopy() {
+ cat $@ | ssh -q $1 -o 'ForwardAgent yes' 'cat|pbcopy'
+}
[ -z "$DARWIN" ] && return 0
md5sum() {
md5 $@ | sed "s/^MD5 (\(.*\)) = \(.*\)$/\2 \1/"
}
-mac-xmessage() {
+mac_xmessage() {
osascript -e "tell app \"System Events\" to display dialog \"$@\""
}
-mac-config() {
+mac_config() {
echo "Finder path : YES"
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
echo "Finder quit : YES"