|
|
@ -6,34 +6,36 @@ |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
# Get the prefix or use the default. |
|
|
|
# Get the prefix or use the default. |
|
|
|
zstyle -s ':prezto:module:gnu-utility' prefix '_gnu_utility_p' || _gnu_utility_p='g' |
|
|
|
zstyle -s ':prezto:module:gnu-utility' prefix '_gnu_utility_p' \ |
|
|
|
|
|
|
|
|| _gnu_utility_p='g' |
|
|
|
|
|
|
|
|
|
|
|
# Return if requirements are not found. |
|
|
|
# Return if requirements are not found. |
|
|
|
if (( ! ${+commands[${_gnu_utility_p}whoami]} )); then |
|
|
|
if (( ! $+commands[${_gnu_utility_p}whoami] )); then |
|
|
|
return 1 |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
_gnu_utility_cmds=( |
|
|
|
_gnu_utility_cmds=( |
|
|
|
# Coreutils |
|
|
|
# Coreutils |
|
|
|
'[' 'b2sum' 'base32' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown' |
|
|
|
'[' 'b2sum' 'base32' 'base64' 'basename' 'basenc' 'cat' 'chcon' 'chgrp' |
|
|
|
'chroot' 'cksum' 'comm' 'cp' 'csplit' 'cut' 'date' 'dd' 'df' |
|
|
|
'chmod' 'chown' 'chroot' 'cksum' 'comm' 'cp' 'csplit' 'cut' |
|
|
|
'dir' 'dircolors' 'dirname' 'du' 'echo' 'env' 'expand' 'expr' |
|
|
|
'date' 'dd' 'df' 'dir' 'dircolors' 'dirname' 'du' 'echo' 'env' 'expand' 'expr' |
|
|
|
'factor' 'false' 'fmt' 'fold' 'groups' 'head' 'hostid' 'id' |
|
|
|
'factor' 'false' 'fmt' 'fold' 'groups' 'head' 'hostid' 'id' 'install' 'join' |
|
|
|
'install' 'join' 'kill' 'link' 'ln' 'logname' 'ls' 'md5sum' 'mkdir' |
|
|
|
'kill' 'link' 'ln' 'logname' 'ls' 'md5sum' 'mkdir' 'mkfifo' |
|
|
|
'mkfifo' 'mknod' 'mktemp' 'mv' 'nice' 'nl' 'nohup' 'nproc' |
|
|
|
'mknod' 'mktemp' 'mv' 'nice' 'nl' 'nohup' 'nproc' 'numfmt' 'od' |
|
|
|
'numfmt' 'od' 'paste' 'pathchk' 'pinky' 'pr' 'printenv' 'printf' 'ptx' |
|
|
|
'paste' 'pathchk' 'pinky' 'pr' 'printenv' 'printf' 'ptx' 'pwd' |
|
|
|
'pwd' 'readlink' 'realpath' 'rm' 'rmdir' 'runcon' 'seq' 'sha1sum' |
|
|
|
'readlink' 'realpath' 'rm' 'rmdir' 'runcon' |
|
|
|
'sha224sum' 'sha256sum' 'sha384sum' 'sha512sum' 'shred' 'shuf' |
|
|
|
'seq' 'sha1sum' 'sha224sum' 'sha256sum' 'sha384sum' 'sha512sum' 'shred' 'shuf' |
|
|
|
'sleep' 'sort' 'split' 'stat' 'stdbuf' 'stty' 'sum' 'sync' 'tac' 'tail' |
|
|
|
'sleep' 'sort' 'split' 'stat' 'stdbuf' 'stty' 'sum' 'sync' 'tac' 'tail' |
|
|
|
'tee' 'test' 'timeout' 'touch' 'tr' 'true' 'truncate' 'tsort' |
|
|
|
'tee' 'test' 'timeout' 'touch' 'tr' 'true' 'truncate' 'tsort' 'tty' |
|
|
|
'tty' 'uname' 'unexpand' 'uniq' 'unlink' 'uptime' 'users' 'vdir' |
|
|
|
'uname' 'unexpand' 'uniq' 'unlink' 'uptime' 'users' 'vdir' |
|
|
|
'wc' 'who' 'whoami' 'yes' |
|
|
|
'wc' 'who' 'whoami' 'yes' |
|
|
|
|
|
|
|
|
|
|
|
# The following utilities are not part of Coreutils but installed separately. |
|
|
|
# The following utilities are not part of Coreutils but installed separately. |
|
|
|
|
|
|
|
|
|
|
|
# Binutils |
|
|
|
# Binutils |
|
|
|
'addr2line' 'ar' 'c++filt' 'elfedit' 'nm' 'objcopy' 'objdump' |
|
|
|
'addr2line' 'ar' 'c++filt' 'coffdump' 'dlltool' 'dllwrap' 'elfedit' 'nm' |
|
|
|
'ranlib' 'readelf' 'size' 'strings' 'strip' |
|
|
|
'objcopy' 'objdump' 'ranlib' 'readelf' |
|
|
|
|
|
|
|
'size' 'srconv' 'strings' 'strip' 'sysdump' 'windmc' 'windres' |
|
|
|
|
|
|
|
|
|
|
|
# Findutils |
|
|
|
# Findutils |
|
|
|
'find' 'locate' 'oldfind' 'updatedb' 'xargs' |
|
|
|
'find' 'locate' 'oldfind' 'updatedb' 'xargs' |
|
|
@ -42,16 +44,18 @@ _gnu_utility_cmds=( |
|
|
|
'libtool' 'libtoolize' |
|
|
|
'libtool' 'libtoolize' |
|
|
|
|
|
|
|
|
|
|
|
# Miscellaneous |
|
|
|
# Miscellaneous |
|
|
|
'getopt' 'grep' 'indent' 'make' 'sed' 'tar' 'time' 'units' 'which' |
|
|
|
'egrep' 'fgrep' 'getopt' 'grep' 'indent' 'make' 'sed' 'tar' 'time' 'units' |
|
|
|
|
|
|
|
'which' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# Wrap GNU utilities in functions. |
|
|
|
# Wrap GNU utilities in functions. |
|
|
|
for _gnu_utility_cmd in "${_gnu_utility_cmds[@]}"; do |
|
|
|
for _gnu_utility_cmd in "${_gnu_utility_cmds[@]}"; do |
|
|
|
_gnu_utility_pcmd="${_gnu_utility_p}${_gnu_utility_cmd}" |
|
|
|
_gnu_utility_pcmd="${_gnu_utility_p}${_gnu_utility_cmd}" |
|
|
|
if (( ${+commands[${_gnu_utility_pcmd}]} && ! ${+builtins[${_gnu_utility_cmd}]} )); then |
|
|
|
if (( $+commands[$_gnu_utility_pcmd] \ |
|
|
|
|
|
|
|
&& ! $+builtins[$_gnu_utility_cmd] )); then |
|
|
|
eval " |
|
|
|
eval " |
|
|
|
function ${_gnu_utility_cmd} { |
|
|
|
function $_gnu_utility_cmd { |
|
|
|
'${commands[${_gnu_utility_pcmd}]}' \"\$@\" |
|
|
|
'$commands[$_gnu_utility_pcmd]' \"\$@\" |
|
|
|
} |
|
|
|
} |
|
|
|
" |
|
|
|
" |
|
|
|
fi |
|
|
|
fi |
|
|
|