Browse Source

Rename gnu-utils to gnu-utility

master
Sorin Ionescu 13 years ago
parent
commit
7bf5773b3d
  1. 6
      modules/gnu-utility/README.md
  2. 18
      modules/gnu-utility/init.zsh

6
modules/gnu-utils/README.md → modules/gnu-utility/README.md

@ -1,5 +1,5 @@
gnu-utils gnu-utility
========= ===========
Provides for the interactive use of [GNU Core Utilities][1] on non-GNU systems. Provides for the interactive use of [GNU Core Utilities][1] on non-GNU systems.
@ -18,7 +18,7 @@ Settings
To use a different prefix, add the following to *zshrc*, and replace 'g' with To use a different prefix, add the following to *zshrc*, and replace 'g' with
the desired prefix: the desired prefix:
zstyle ':omz:module:gnu-utils' prefix 'g' zstyle ':omz:module:gnu-utility' prefix 'g'
Authors Authors
------- -------

18
modules/gnu-utils/init.zsh → modules/gnu-utility/init.zsh

@ -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}
Loading…
Cancel
Save