config/bash: make aliases modular
This commit is contained in:
parent
ae45f56e6e
commit
da339ad705
|
@ -0,0 +1,31 @@
|
|||
set -o pipefail
|
||||
|
||||
list() {
|
||||
type="$1"
|
||||
shift
|
||||
if test $# -eq 0 && echo $type | grep -q -- '-domains$'
|
||||
then for user in $(list users)
|
||||
do test -t 1 && echo "[4m$user[0m"
|
||||
list "$type" "$user"
|
||||
done
|
||||
else if test -t 1
|
||||
then sudo "/usr/local/hestia/bin/v-list-$type" "$@" | column -t
|
||||
else sudo "/usr/local/hestia/bin/v-list-$type" "$@" | tail +3 | awk '{print $1}'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
hestia() {
|
||||
test $# -eq 0 && cd /usr/local/hestia && return 0
|
||||
set -x
|
||||
command=$1
|
||||
shift
|
||||
sudo $(which $command) "$@"
|
||||
set +x
|
||||
}
|
||||
|
||||
accessible() {
|
||||
dir=/home/*/web/$1/public_html
|
||||
sudo chmod -v 755 $dir
|
||||
sudo chown -v :sudo $dir
|
||||
}
|
|
@ -263,6 +263,7 @@ curlh() {
|
|||
curl -v --location "$@" >/dev/null
|
||||
}
|
||||
|
||||
unalias u 2>/dev/null # for bash
|
||||
u() {
|
||||
# Line below handy for users of netkeeper
|
||||
sudo nft list ruleset | grep -q outall && echo "Suspending netkeeper" >&2 | echo 'pausing netkeeper for sysupgrade' | netkeeper 30 2>/dev/null
|
||||
|
@ -331,8 +332,9 @@ sshl() {
|
|||
! [[ "$1" =~ "delta*" ]] &&
|
||||
local pass=pass
|
||||
test "$all" &&
|
||||
$pass scp -O ~/.bash_aliases "$1:" &&
|
||||
$pass ssh "$1" 'grep -q ".bash_aliases" .bashrc || echo "source ~/.bash_aliases" >>.bashrc'
|
||||
find $XDG_CONFIG_HOME/bash/ \( -name aliases.bash -o -name "$1*.bash" \) -exec cat {} + | $pass ssh "$1" 'cat > .bash_aliases && grep -q .bash_aliases .bashrc || echo "source ~/.bash_aliases" | tee -a .bashrc' &&
|
||||
echo 'Updated .bash_aliases!'
|
||||
#$pass ssh "$1" 'grep -q ".bash_aliases" .bashrc || echo "source ~/.bash_aliases" >>.bashrc'
|
||||
if test -n "$pass"
|
||||
then pass ssh "$@"
|
||||
else
|
||||
|
|
|
@ -140,7 +140,7 @@ test "$DISPLAY" || exit 0
|
|||
highlight "Desktop Applications"
|
||||
|
||||
subhighlight "Application symlinks"
|
||||
link .bash_aliases "$HOME/.bashrc"
|
||||
link "$XDG_CONFIG_HOME/bash/aliases.bash" "$HOME/.bashrc"
|
||||
link "$HOME/.ssh/config" "$XDG_CONFIG_HOME/ssh"
|
||||
link "$XDG_DATA_HOME/.cpan/CPAN/MyConfig.pm" "$XDG_CONFIG_HOME/cpan/MyConfig.pm"
|
||||
|
||||
|
|
Loading…
Reference in New Issue