added yay
- check if command is yay or nano (config), otherwise command is pacman - check if su is needed only for pacman and not yay - check command arguments after determining command (or empty, which is default, pacman)
This commit is contained in:
parent
fc0983dbb4
commit
53f86fa804
69
pman.sh
69
pman.sh
@ -3,38 +3,59 @@
|
|||||||
# Store the first command line argument in the variable "command" and shift the rest
|
# Store the first command line argument in the variable "command" and shift the rest
|
||||||
command_args="$1"
|
command_args="$1"
|
||||||
shift
|
shift
|
||||||
|
command=""
|
||||||
|
more_arguments=false
|
||||||
|
su_needed=false
|
||||||
|
|
||||||
# Evaluate the command arguments
|
# Check if yay (aur)
|
||||||
if [ "$command_args" = "search" ]; then
|
if [ "$command_args" = "yay" ]; then
|
||||||
command="pacman"
|
command="yay"
|
||||||
command_args="-Ss"
|
command_args="$1"
|
||||||
elif [ "$command_args" = "update" ]; then
|
shift
|
||||||
command="pacman"
|
more_arguments=true
|
||||||
command_args="-Sy"
|
# Check if config
|
||||||
su_needed=true
|
|
||||||
elif [ "$command_args" = "upgradable" ]; then
|
|
||||||
command="pacman"
|
|
||||||
command_args="-Qu"
|
|
||||||
elif [ "$command_args" = "upgrade" ]; then
|
|
||||||
command="pacman"
|
|
||||||
command_args="-Syu"
|
|
||||||
su_needed=true
|
|
||||||
elif [ "$command_args" = "install" ]; then
|
|
||||||
command="pacman"
|
|
||||||
command_args="-S"
|
|
||||||
su_needed=true
|
|
||||||
elif [ "$command_args" = "provides" ]; then
|
|
||||||
command="pacman"
|
|
||||||
command_args="-F"
|
|
||||||
elif [ "$command_args" = "config" ]; then
|
elif [ "$command_args" = "config" ]; then
|
||||||
command="nano"
|
command="nano"
|
||||||
command_args="/etc/pacman.conf"
|
command_args="/etc/pacman.conf"
|
||||||
su_needed=true
|
su_needed=true
|
||||||
else
|
fi
|
||||||
echo "Invalid command: \"$command_args\""
|
|
||||||
|
# If command is empty, command is pacman
|
||||||
|
if [ "$command" = "" ]; then
|
||||||
|
command="pacman"
|
||||||
|
more_arguments=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Evaluate the command arguments
|
||||||
|
if [ "$command_args" = "search" ]; then
|
||||||
|
command_args="-Ss"
|
||||||
|
elif [ "$command_args" = "update" ]; then
|
||||||
|
command_args="-Sy"
|
||||||
|
if [ "$command" = "pacman" ]; then
|
||||||
|
su_needed=true
|
||||||
|
fi
|
||||||
|
elif [ "$command_args" = "upgradable" ]; then
|
||||||
|
command_args="-Qu"
|
||||||
|
elif [ "$command_args" = "upgrade" ]; then
|
||||||
|
command_args="-Syu"
|
||||||
|
if [ "$command" = "pacman" ]; then
|
||||||
|
su_needed=true
|
||||||
|
fi
|
||||||
|
elif [ "$command_args" = "install" ]; then
|
||||||
|
command_args="-S"
|
||||||
|
if [ "$command" = "pacman" ]; then
|
||||||
|
su_needed=true
|
||||||
|
fi
|
||||||
|
elif [ "$command_args" = "provides" ]; then
|
||||||
|
command_args="-F"
|
||||||
|
elif [ "$more_arguments" = "true" ]; then
|
||||||
|
echo "Invalid command: \"$command $command_args\""
|
||||||
echo
|
echo
|
||||||
echo "Usage: pman <command> [args...]"
|
echo "Usage: pman <command> [args...]"
|
||||||
echo "Available commands:"
|
echo "Available commands:"
|
||||||
|
echo " yay (aur) - yay | invoke yay "
|
||||||
|
echo " (aur packages - all the normal operations except config are available)"
|
||||||
|
echo " aur (yay) - yay | same as \"yay\""
|
||||||
echo " search - pacman -Ss | search packages"
|
echo " search - pacman -Ss | search packages"
|
||||||
echo " update - pacman -Sy | updates the repositories"
|
echo " update - pacman -Sy | updates the repositories"
|
||||||
echo " upgradable - pacman -Qu | list available upgrades"
|
echo " upgradable - pacman -Qu | list available upgrades"
|
||||||
|
Loading…
Reference in New Issue
Block a user