]>
git.rmz.io Git - dotfiles.git/blob - zsh/plugins/gnu-utils/gnu-utils.plugin.zsh
1 # ------------------------------------------------------------------------------
2 # FILE: gnu-utils.plugin.zsh
3 # DESCRIPTION: oh-my-zsh plugin file.
4 # AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
6 # ------------------------------------------------------------------------------
9 if [[ -x "${commands[gwhoami]}" ]]; then
18 gcmds
=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
19 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
20 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
21 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
22 'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
23 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
24 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
25 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
26 'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
27 'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
28 'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
29 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
32 # Not part of coreutils, installed separately.
33 gcmds
+=('gsed' 'gtar' 'gtime')
35 for gcmd
in "${gcmds[@]}"; do
37 # This method allows for builtin commands to be primary but it's
38 # lost if hash -r or rehash -f is executed. Thus, those two
39 # functions have to be wrapped.
41 (( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}
44 # This method generates wrapper functions.
45 # It will override shell builtins.
47 # (( ${+commands[$gcmd]} )) && \
48 # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
51 # This method is inflexible since the aliases are at risk of being
52 # overriden resulting in the BSD coreutils being called.
54 # (( ${+commands[$gcmd]} )) && \
55 # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
63 if [[ "$*" =~
"-(r|f)" ]]; then
72 if [[ "$*" =~
"-f" ]]; then