mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 10:29:25 +00:00
Rename gnu-utils to gnu-utility
This commit is contained in:
31
modules/gnu-utility/README.md
Normal file
31
modules/gnu-utility/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
gnu-utility
|
||||
===========
|
||||
|
||||
Provides for the interactive use of [GNU Core Utilities][1] on non-GNU systems.
|
||||
|
||||
Installing the GNU Core Utilities on non-GNU systems in `$PATH` without
|
||||
a prefix, i.e. `ls` instead of `gls`, is not recommended since scripts that
|
||||
target other core utilities will be broken.
|
||||
|
||||
However, for interactive use, prefixed commands can be hashed to their
|
||||
non-prefixed counterparts.
|
||||
|
||||
Settings
|
||||
--------
|
||||
|
||||
### Prefix
|
||||
|
||||
To use a different prefix, add the following to *zshrc*, and replace 'g' with
|
||||
the desired prefix:
|
||||
|
||||
zstyle ':omz:module:gnu-utility' prefix 'g'
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
*The authors of this module should be contacted via the GitHub issue tracker.*
|
||||
|
||||
- [Sorin Ionescu](/sorin-ionescu)
|
||||
|
||||
[1]: http://www.gnu.org/software/coreutils/
|
||||
|
61
modules/gnu-utility/init.zsh
Normal file
61
modules/gnu-utility/init.zsh
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# Provides for the interactive usage of GNU Coreutils on BSD systems.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# Get the prefix or use the default.
|
||||
zstyle -s ':omz:module:gnu-utility' prefix '_gnu_utility_p' || _gnu_utility_p='g'
|
||||
|
||||
# Check for the presence of GNU Core Utilities.
|
||||
if (( ! ${+commands[${_gnu_utility_p}dircolors]} )); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
_gnu_utility_cmds=(
|
||||
# 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.
|
||||
for _gnu_utility_cmd in "${_gnu_utility_cmds[@]}"; do
|
||||
_gnu_utility_pcmd="${_gnu_utility_p}${_gnu_utility_cmd}"
|
||||
if (( ${+commands[${_gnu_utility_pcmd}]} )); then
|
||||
eval "
|
||||
function ${_gnu_utility_cmd} {
|
||||
'${commands[${_gnu_utility_pcmd}]}' \"\$@\"
|
||||
}
|
||||
"
|
||||
fi
|
||||
done
|
||||
|
||||
unset _gnu_utility_{p,cmds,cmd,pcmd}
|
||||
|
Reference in New Issue
Block a user