|
|
@ -6,14 +6,14 @@ |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
# Get the prefix or use the default. |
|
|
|
# Get the prefix or use the default. |
|
|
|
zstyle -s ':omz:module:gnu-utils' prefix '_gnu_utils_p' || _gnu_utils_p='g' |
|
|
|
zstyle -s ':omz:module:gnu-utility' prefix '_gnu_utility_p' || _gnu_utility_p='g' |
|
|
|
|
|
|
|
|
|
|
|
# Check for the presence of GNU Core Utilities. |
|
|
|
# Check for the presence of GNU Core Utilities. |
|
|
|
if (( ! ${+commands[${_gnu_utils_p}dircolors]} )); then |
|
|
|
if (( ! ${+commands[${_gnu_utility_p}dircolors]} )); then |
|
|
|
return 1 |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
_gnu_utils_cmds=( |
|
|
|
_gnu_utility_cmds=( |
|
|
|
# Coreutils |
|
|
|
# Coreutils |
|
|
|
'[' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown' |
|
|
|
'[' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown' |
|
|
|
'chroot' 'cksum' 'comm' 'cp' 'csplit' 'cut' 'date' 'dd' 'df' |
|
|
|
'chroot' 'cksum' 'comm' 'cp' 'csplit' 'cut' 'date' 'dd' 'df' |
|
|
@ -46,16 +46,16 @@ _gnu_utils_cmds=( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# Wrap GNU utilities in functions. |
|
|
|
# Wrap GNU utilities in functions. |
|
|
|
for _gnu_utils_cmd in "${_gnu_utils_cmds[@]}"; do |
|
|
|
for _gnu_utility_cmd in "${_gnu_utility_cmds[@]}"; do |
|
|
|
_gnu_utils_pcmd="${_gnu_utils_p}${_gnu_utils_cmd}" |
|
|
|
_gnu_utility_pcmd="${_gnu_utility_p}${_gnu_utility_cmd}" |
|
|
|
if (( ${+commands[${_gnu_utils_pcmd}]} )); then |
|
|
|
if (( ${+commands[${_gnu_utility_pcmd}]} )); then |
|
|
|
eval " |
|
|
|
eval " |
|
|
|
function ${_gnu_utils_cmd} { |
|
|
|
function ${_gnu_utility_cmd} { |
|
|
|
'${commands[${_gnu_utils_pcmd}]}' \"\$@\" |
|
|
|
'${commands[${_gnu_utility_pcmd}]}' \"\$@\" |
|
|
|
} |
|
|
|
} |
|
|
|
" |
|
|
|
" |
|
|
|
fi |
|
|
|
fi |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
unset _gnu_utils_{p,cmds,cmd,pcmd} |
|
|
|
unset _gnu_utility_{p,cmds,cmd,pcmd} |
|
|
|
|
|
|
|
|