Simplify help function, add help to mediacontrol.sh
This commit is contained in:
@@ -6,6 +6,42 @@ RELOAD="pkill -RTMIN+1 i3blocks"
|
|||||||
|
|
||||||
[ -z "$2" ] && NUM="2" || NUM="$2"
|
[ -z "$2" ] && NUM="2" || NUM="$2"
|
||||||
|
|
||||||
|
help() {
|
||||||
|
B=$(tput bold)
|
||||||
|
N=$(tput sgr0)
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
${B}NAME${N}
|
||||||
|
mediacontrol - control the volume of the system
|
||||||
|
|
||||||
|
${B}SYNOPSIS${N}
|
||||||
|
./mediacontrol.sh <command> [<arg1>]
|
||||||
|
|
||||||
|
${B}DESCRIPTION${N}
|
||||||
|
Commands can be truncated, i.e.
|
||||||
|
\`${B}mediacontrol.sh t${N}\` for \`${B}mediacontrol.sh toggle${N}\`
|
||||||
|
|
||||||
|
Arguments need to be of numeric value.
|
||||||
|
|
||||||
|
${B}COMMANDS${N}
|
||||||
|
${B}u*, up <amount>${N}
|
||||||
|
|
||||||
|
${B}d*, down <amount>${N}
|
||||||
|
|
||||||
|
${B}s*, set <volume>${N}
|
||||||
|
|
||||||
|
${B}t*, toggle${N}
|
||||||
|
|
||||||
|
${B}m*, mute${N}
|
||||||
|
|
||||||
|
${B}u*, unmute${N}
|
||||||
|
|
||||||
|
${B}getv*, getvolume${N}
|
||||||
|
|
||||||
|
${B}getm*, getmute${N}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
u*) pulsemixer --change-volume +"$NUM" ; $RELOAD ;;
|
u*) pulsemixer --change-volume +"$NUM" ; $RELOAD ;;
|
||||||
d*) pulsemixer --change-volume -"$NUM" ; $RELOAD ;;
|
d*) pulsemixer --change-volume -"$NUM" ; $RELOAD ;;
|
||||||
@@ -15,4 +51,5 @@ case "$1" in
|
|||||||
u*) pulsemixer --unmute ; $RELOAD ;;
|
u*) pulsemixer --unmute ; $RELOAD ;;
|
||||||
getv*) pulsemixer --get-volume | awk '{print $1}' ;;
|
getv*) pulsemixer --get-volume | awk '{print $1}' ;;
|
||||||
getm*) pulsemixer --get-mute ;;
|
getm*) pulsemixer --get-mute ;;
|
||||||
|
*) help ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
+27
-27
@@ -9,33 +9,33 @@ START="$DIR/start"
|
|||||||
OPT="$DIR/opt"
|
OPT="$DIR/opt"
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
BOLD=$(tput bold)
|
B=$(tput bold)
|
||||||
NORMAL=$(tput sgr0)
|
N=$(tput sgr0)
|
||||||
|
|
||||||
echo "${BOLD}NAME${NORMAL}"
|
cat << EOF
|
||||||
echo " vimplugin - vim plugin manager"
|
${B}NAME${N}
|
||||||
echo ""
|
vimplugin - vim plugin manager
|
||||||
echo "${BOLD}SYNOPSIS${NORMAL}"
|
|
||||||
echo " ./vimplugin.sh <command> [<arg1> <arg2>]"
|
${B}SYNOPSIS${N}
|
||||||
echo ""
|
./vimplugin.sh <command> [<arg1> <arg2>]
|
||||||
echo "${BOLD}COMMANDS${NORMAL}"
|
|
||||||
echo " init"
|
${B}COMMANDS${N}
|
||||||
echo " Creates all the required directories/files."
|
${B}init${N}
|
||||||
echo ""
|
Creates all the required directories/files.
|
||||||
echo " install <url> [\"start\"/\"opt\"]"
|
|
||||||
echo " Install a new plugin, <url> need to be a valid \
|
${B}install <url> ["start"/"opt"]${N}
|
||||||
GitHub URL,
|
Install a new plugin, <url> need to be a valid GitHub URL,
|
||||||
start/opt to install the plugin in the start/opt directory \
|
start/opt to install the plugin in the start/opt directory
|
||||||
(default: start)."
|
(default: start).
|
||||||
echo ""
|
|
||||||
echo " list <number>"
|
${B}list <number>${N}
|
||||||
echo " Prints all the installed plugins, <number> prints \
|
Prints all the installed plugins,
|
||||||
just the plugin in that position."
|
<number> prints just the plugin in that position.
|
||||||
echo " remove"
|
${B}remove${N}
|
||||||
echo " Remove plugin, script will prompt a selection menu."
|
Remove plugin, script will prompt a selection menu.
|
||||||
echo " update"
|
${B}update${N}
|
||||||
echo " Installs/updates all plugins from the config file."
|
Installs/updates all plugins from the config file.
|
||||||
echo ""
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@@ -146,6 +146,6 @@ remove() {
|
|||||||
if type "$1" 2> /dev/null | grep -q "function"; then
|
if type "$1" 2> /dev/null | grep -q "function"; then
|
||||||
"$@"
|
"$@"
|
||||||
else
|
else
|
||||||
echo "script: command not found: $1"
|
help
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+34
-33
@@ -14,39 +14,40 @@ FILES=$(find . \( -path ./.git -o \
|
|||||||
-path ./screenshot.png \) -prune -o -type f -print)
|
-path ./screenshot.png \) -prune -o -type f -print)
|
||||||
|
|
||||||
if [ "$1" == "help" ] || [ "$1" == "" ]; then
|
if [ "$1" == "help" ] || [ "$1" == "" ]; then
|
||||||
BOLD=$(tput bold)
|
B=$(tput bold)
|
||||||
NORMAL=$(tput sgr0)
|
N=$(tput sgr0)
|
||||||
|
|
||||||
echo "${BOLD}NAME${NORMAL}"
|
cat << EOF
|
||||||
echo " dotfiles - file copy script for this repository"
|
${B}NAME${N}
|
||||||
echo ""
|
dotfiles - file copy script for the dotfiles repository
|
||||||
echo "${BOLD}SYNOPSIS${NORMAL}"
|
|
||||||
echo " ./dotfiles.sh <command> [<args>]"
|
${B}SYNOPSIS${N}
|
||||||
echo ""
|
./dotfiles.sh <command> [<args>]
|
||||||
echo "${BOLD}COMMANDS${NORMAL}"
|
|
||||||
echo " list"
|
${B}COMMANDS${N}
|
||||||
echo " Prints all the dotfiles added to this directory."
|
${B}list${N}
|
||||||
echo ""
|
Print all files added to the dotfiles directory.
|
||||||
echo " get <filepath>"
|
|
||||||
echo " Add file to this directory."
|
${B}get <filepath>${N}
|
||||||
echo ""
|
Add file to the dotfiles directory.
|
||||||
echo " pull"
|
|
||||||
echo " For each file in this directory, copy that file \
|
${B}pull${N}
|
||||||
on the system to this directory."
|
For each file in the dotfiles directory, copy that file on the system to
|
||||||
echo ""
|
the dotfiles directory.
|
||||||
echo " push"
|
|
||||||
echo " For each file in this directory, copy that file \
|
${B}push${N}
|
||||||
to its location on the system."
|
For each file in the dotfiles directory, copy that file to its location
|
||||||
echo ""
|
on the system.
|
||||||
echo " package [list]"
|
|
||||||
echo " List all the packages installed on the system."
|
${B}packages [list]${N}
|
||||||
echo ""
|
List all the packages installed on the system.
|
||||||
echo " package store"
|
|
||||||
echo " Store the list of all the installed packages on the \
|
${B}packages store${N}
|
||||||
system."
|
Store the list of all the installed packages on the system.
|
||||||
echo ""
|
|
||||||
echo " package install"
|
${B}packages install${N}
|
||||||
echo " Install all the core packages of the list."
|
Install all the core packages of the list.
|
||||||
|
EOF
|
||||||
|
|
||||||
elif [ "$1" == "list" ]; then
|
elif [ "$1" == "list" ]; then
|
||||||
for f in $FILES; do
|
for f in $FILES; do
|
||||||
@@ -91,7 +92,7 @@ elif [ "$1" == "pull" ] || [ "$1" == "push" ]; then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
elif [ "$1" == "package" ]; then
|
elif [ "$1" == "packages" ]; then
|
||||||
PACKAGE_LIST=$(comm -23 <(pacman -Qeq | sort) <(pacman -Qgq base base-devel | sort))
|
PACKAGE_LIST=$(comm -23 <(pacman -Qeq | sort) <(pacman -Qgq base base-devel | sort))
|
||||||
|
|
||||||
if [ "$2" == "list" ] || [ "$2" == "" ]; then
|
if [ "$2" == "list" ] || [ "$2" == "" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user