mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Merge ba76e0a70c into 291e96dcd0
This commit is contained in:
commit
37664b1059
2 changed files with 60 additions and 0 deletions
8
plugins/autosudo/README.md
Normal file
8
plugins/autosudo/README.md
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
Development
|
||||||
|
============
|
||||||
|
|
||||||
|
1. virtual_env pip
|
||||||
|
if virtual env path is writeable by user (e.g. $HOME), not need sudo.
|
||||||
|
export VIRTURL_ENV="path"
|
||||||
|
|
||||||
52
plugins/autosudo/autosudo.plugin.zsh
Normal file
52
plugins/autosudo/autosudo.plugin.zsh
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
[ $(id -u) -eq 0 ] && return
|
||||||
|
|
||||||
|
function pacman() {
|
||||||
|
case $1 in
|
||||||
|
-S | -S[^sih]* | -R* | -U*) sudo pacman $* ;;
|
||||||
|
* ) command pacman $* ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function clyde() {
|
||||||
|
case $1 in
|
||||||
|
-S | -S[^sih]* | -R* | -U*) sudo clyde $* ;;
|
||||||
|
* ) command clyde $* ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# special: virtual_env
|
||||||
|
function pip() {
|
||||||
|
if [[ -n ${VIRTUAL_ENV+1} && -w $VIRTUAL_ENV ]] ; then
|
||||||
|
command pip $*
|
||||||
|
else
|
||||||
|
case $1 in
|
||||||
|
install | uninstall ) sudo pip $* ;;
|
||||||
|
*) command pip $* ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function npm() {
|
||||||
|
case $1 in
|
||||||
|
install | uninstall ) sudo npm $* ;;
|
||||||
|
*) command npm $* ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function mount() {
|
||||||
|
case $i in
|
||||||
|
"" ) command mount ;;
|
||||||
|
* ) sudo mount $* ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
alias umount="sudo umount"
|
||||||
|
|
||||||
|
alias dhdpcd="sudo dhcpcd"
|
||||||
|
alias netcfg="sudo netcfg"
|
||||||
|
|
||||||
|
alias halt="sudo halt"
|
||||||
|
alias reboot="sudo reboot"
|
||||||
|
|
||||||
|
alias easy_install="sudo easy_install"
|
||||||
|
|
||||||
|
alias pppoe-connect="sudo pppoe-connect"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue