added pman.sh, edited README.md accordingly
This commit is contained in:
parent
06ca943098
commit
6455b904c4
14
README.md
14
README.md
@ -1 +1,15 @@
|
||||
# pman.sh
|
||||
A `pacman` helper script, because you forget the stupid flags
|
||||
|
||||
## Usage / Features:
|
||||
- search
|
||||
- update
|
||||
- upgradable
|
||||
- upgrade
|
||||
- install
|
||||
- provides
|
||||
- config
|
||||
|
||||
`config` is the only flag that is not appended to `pacman`, instead it resolves to `nano /etc/pacman.conf`.
|
||||
|
||||
`sudo` gets prepended automatically if the command requires it and if installed - no, there is no check if your user is in the `sudo` group, if you download this script you should already be, or know you can only use part of this utility
|
||||
|
52
pman.sh
Executable file
52
pman.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Store the first command line argument in the variable "command" and shift the rest
|
||||
command="$1"
|
||||
shift
|
||||
|
||||
# Evaluate the command
|
||||
if [ "$command" = "search" ]; then
|
||||
command="pacman"
|
||||
command_args="-Ss"
|
||||
elif [ "$command" = "update" ]; then
|
||||
command="pacman"
|
||||
command_args="-Sy"
|
||||
su_needed=true
|
||||
elif [ "$command" = "upgradable" ]; then
|
||||
command="pacman"
|
||||
command_args="-Qu"
|
||||
elif [ "$command" = "upgrade" ]; then
|
||||
command="pacman"
|
||||
command_args="-Syu"
|
||||
su_needed=true
|
||||
elif [ "$command" = "install" ]; then
|
||||
command="pacman"
|
||||
command_args="-S"
|
||||
su_needed=true
|
||||
elif [ "$command" = "provides" ]; then
|
||||
command="pacman"
|
||||
command_args="-F"
|
||||
elif [ "$command" = "config" ]; then
|
||||
command="nano"
|
||||
command_args="/etc/pacman.conf"
|
||||
su_needed=true
|
||||
else
|
||||
echo "Invalid command: \"$command\""
|
||||
echo
|
||||
echo "Usage: pman <command> [args...]"
|
||||
echo "Available commands:"
|
||||
echo " search - pacman -Ss | search packages"
|
||||
echo " update - pacman -Sy | updates the repositories"
|
||||
echo " upgradable - pacman -Qu | list available upgrades"
|
||||
echo " upgrade - pacman -Syu | upgrades your system"
|
||||
echo " provides - pacman -F | list packages that provide file"
|
||||
echo " config - /etc/pacman.conf | edits pacman configuration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If sudo is needed and necessary (and installed), prepend it
|
||||
if [ "$su_needed" = "true" ] && [ "$UID" != 0 ] && command -v "sudo" &>/dev/null; then
|
||||
sudo $command $command_args "${@}"
|
||||
else
|
||||
$command $command_args "${@}"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user