You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.9 KiB
62 lines
1.9 KiB
13 years ago
|
#
|
||
|
# Provides for the interactive usage of GNU Coreutils on BSD systems.
|
||
|
#
|
||
|
# Authors:
|
||
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||
|
#
|
||
13 years ago
|
|
||
|
# Get the prefix or use the default.
|
||
13 years ago
|
zstyle -s ':omz:module:gnu-utility' prefix '_gnu_utility_p' || _gnu_utility_p='g'
|
||
14 years ago
|
|
||
13 years ago
|
# Check for the presence of GNU Core Utilities.
|
||
13 years ago
|
if (( ! ${+commands[${_gnu_utility_p}dircolors]} )); then
|
||
13 years ago
|
return 1
|
||
|
fi
|
||
14 years ago
|
|
||
13 years ago
|
_gnu_utility_cmds=(
|
||
13 years ago
|
# 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'
|
||
|
|
||
|
# The following are not part of Coreutils but installed separately.
|
||
|
|
||
|
# 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.
|
||
13 years ago
|
for _gnu_utility_cmd in "${_gnu_utility_cmds[@]}"; do
|
||
|
_gnu_utility_pcmd="${_gnu_utility_p}${_gnu_utility_cmd}"
|
||
|
if (( ${+commands[${_gnu_utility_pcmd}]} )); then
|
||
13 years ago
|
eval "
|
||
13 years ago
|
function ${_gnu_utility_cmd} {
|
||
|
'${commands[${_gnu_utility_pcmd}]}' \"\$@\"
|
||
13 years ago
|
}
|
||
|
"
|
||
13 years ago
|
fi
|
||
13 years ago
|
done
|
||
13 years ago
|
|
||
13 years ago
|
unset _gnu_utility_{p,cmds,cmd,pcmd}
|
||
13 years ago
|
|