Make osx functions autoloadable

main
Sorin Ionescu 11 years ago
parent b8bb51d7b5
commit bccfca8c10

@ -9,8 +9,7 @@ Aliases
- `cdf` changes the current working director to the current _Finder_
directory.
- `pushdf` pushes the current working directory onto the directory queue and
- `ql` quick looks at files.
- `rm-osx-cruft` deletes .DS\_Store, \_\_MACOSX cruft.
changes the current working director to the current _Finder_ directory.
Functions
---------
@ -20,6 +19,8 @@ Functions
- `pfd` prints the current _Finder_ directory.
- `pfs` prints the current _Finder_ selection.
- `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]).
- `ql` previews files in Quick Look.
- `rm-osx-cruft` deletes .DS\_Store, \_\_MACOSX cruft.
Authors
-------

@ -0,0 +1,10 @@
#
# Previews files in Quick Look.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
if (( $# > 0 )); then
qlmanage -p "$@" &> /dev/null
fi

@ -0,0 +1,11 @@
#
# Deletes .DS_Store and __MACOSX directories.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
find "${@:-$PWD}" \( \
-type f -name '.DS_Store' -o \
-type d -name '__MACOSX' \
\) -print0 | xargs -0 rm -rf

@ -19,21 +19,3 @@ alias cdf='cd "$(pfd)"'
# Push directory to the current Finder directory.
alias pushdf='pushd "$(pfd)"'
#
# Functions
#
# Open files in Quick Look.
function ql {
(( $# > 0 )) && qlmanage -p "$@" &> /dev/null
}
# Delete .DS_Store and __MACOSX directories.
function rm-osx-cruft {
find "${@:-$PWD}" \( \
-type f -name '.DS_Store' -o \
-type d -name '__MACOSX' \
\) -print0 | xargs -0 rm -rf
}

Loading…
Cancel
Save