2012-02-01 04:37:51 +00:00
|
|
|
#
|
2012-04-11 20:48:09 +00:00
|
|
|
# Provides for the interactive use of GNU utilities on BSD systems.
|
2012-02-01 04:37:51 +00:00
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
2012-04-02 16:00:34 +00:00
|
|
|
|
|
|
|
# Get the prefix or use the default.
|
2012-09-03 20:08:39 +00:00
|
|
|
zstyle -s ':prezto:module:gnu-utility' prefix '_gnu_utility_p' || _gnu_utility_p='g'
|
2011-02-03 22:25:45 +00:00
|
|
|
|
2012-07-23 19:00:44 +00:00
|
|
|
# Return if requirements are not found.
|
2012-07-19 19:49:00 +00:00
|
|
|
if (( ! ${+commands[${_gnu_utility_p}whoami]} )); then
|
2012-03-28 16:23:02 +00:00
|
|
|
return 1
|
|
|
|
fi
|
2011-02-03 22:25:45 +00:00
|
|
|
|
2012-04-11 20:11:07 +00:00
|
|
|
_gnu_utility_cmds=(
|
2012-04-11 03:19:02 +00:00
|
|
|
# Coreutils
|
|
|
|
'[' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown'
|
|
|
|
'chroot' 'cksum' 'comm' 'cp' 'csplit' 'cut' 'date' 'dd' 'df'
|
|
|
|
'dir' 'dircolors' 'dirname' 'du' 'echo' 'env' 'expand' 'expr'
|
|
|
|
'factor' 'false' 'fmt' 'fold' 'groups' 'head' 'hostid' 'id'
|
|
|
|
'install' 'join' 'kill' 'link' 'ln' 'logname' 'ls' 'md5sum'
|
|
|
|
'mkdir' 'mkfifo' 'mknod' 'mktemp' 'mv' 'nice' 'nl' 'nohup' 'nproc'
|
|
|
|
'od' 'paste' 'pathchk' 'pinee' 'pr' 'printenv' 'printf' 'ptx'
|
|
|
|
'pwd' 'readlink' 'realpath' 'rm' 'rmdir' 'runcon' 'seq' 'sha1sum'
|
|
|
|
'sha224sum' 'sha256sum' 'sha384sum' 'sha512sum' 'shred' 'shuf'
|
|
|
|
'sleep' 'sort' 'split' 'stat' 'stty' 'sum' 'sync' 'tac' 'tail'
|
|
|
|
'tee' 'test' 'timeout' 'touch' 'tr' 'true' 'truncate' 'tsort'
|
|
|
|
'tty' 'uname' 'unexpand' 'uniq' 'unlink' 'uptime' 'users' 'vdir'
|
|
|
|
'wc' 'who' 'whoami' 'yes'
|
|
|
|
|
2012-08-04 18:53:38 +00:00
|
|
|
# The following utilities are not part of Coreutils but installed separately.
|
2012-04-11 03:19:02 +00:00
|
|
|
|
|
|
|
# Binutils
|
|
|
|
'addr2line' 'ar' 'c++filt' 'elfedit' 'nm' 'objcopy' 'objdump'
|
|
|
|
'ranlib' 'readelf' 'size' 'strings' 'strip'
|
|
|
|
|
|
|
|
# Findutils
|
|
|
|
'find' 'locate' 'oldfind' 'updatedb' 'xargs'
|
|
|
|
|
|
|
|
# Libtool
|
|
|
|
'libtool' 'libtoolize'
|
|
|
|
|
|
|
|
# Miscellaneous
|
|
|
|
'getopt' 'grep' 'indent' 'sed' 'tar' 'time' 'units' 'which'
|
|
|
|
)
|
|
|
|
|
|
|
|
# Wrap GNU utilities in functions.
|
2012-04-11 20:11:07 +00:00
|
|
|
for _gnu_utility_cmd in "${_gnu_utility_cmds[@]}"; do
|
|
|
|
_gnu_utility_pcmd="${_gnu_utility_p}${_gnu_utility_cmd}"
|
|
|
|
if (( ${+commands[${_gnu_utility_pcmd}]} )); then
|
2012-04-11 03:19:02 +00:00
|
|
|
eval "
|
2012-04-11 20:11:07 +00:00
|
|
|
function ${_gnu_utility_cmd} {
|
|
|
|
'${commands[${_gnu_utility_pcmd}]}' \"\$@\"
|
2012-04-11 03:19:02 +00:00
|
|
|
}
|
|
|
|
"
|
2012-03-28 16:23:02 +00:00
|
|
|
fi
|
2012-04-11 03:19:02 +00:00
|
|
|
done
|
2012-03-28 16:23:02 +00:00
|
|
|
|
2012-04-11 20:11:07 +00:00
|
|
|
unset _gnu_utility_{p,cmds,cmd,pcmd}
|
2012-03-28 16:23:02 +00:00
|
|
|
|