You are not logged in.
I'm trying to write function which automatically runs pacman with sudo if needed. Basically equivalent of this in bash:
pacman() {
case $1 in
-S | -D | -S[^sih]* | -R* | -U*)
/usr/bin/sudo /usr/bin/pacman "$@" ;;
*) /usr/bin/pacman "$@" ;;
esac
}
Here's what I got so far:
function pacman
switch $argv[1]
case '-S' '-D' '-S[^sih]*' '-R*' '-U*'
/usr/bin/sudo /usr/bin/pacman $argv
case '*'
/usr/bin/pacman $argv
end
end
After successful execution of /usr/bin/sudo /usr/bin/pacman I cannot see the character's I'm typing.
Also if I deny installation/removal of package the shell prompt spawns in the same line as the query instead of a new line.
Last edited by silenc3r (2013-05-12 14:49:03)
Offline
It seems to be some bug in current repo version of fish (fish 2.0b2-4). After installing fish-shell-git from AUR all problems disappeared.
Here's final version of the pacman.fish in case anyone's interested:
function pacman
switch $argv[1]
case '-D' '-R*' '-U*' '-S' '-Sc*' '-Sd*' '-Su*' '-Sw*' '-Sy*'
/usr/bin/sudo /usr/bin/pacman $argv
case '*'
/usr/bin/pacman $argv
end
end
Offline