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"
|
||||
|
||||
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
|
||||
u*) pulsemixer --change-volume +"$NUM" ; $RELOAD ;;
|
||||
d*) pulsemixer --change-volume -"$NUM" ; $RELOAD ;;
|
||||
@@ -15,4 +51,5 @@ case "$1" in
|
||||
u*) pulsemixer --unmute ; $RELOAD ;;
|
||||
getv*) pulsemixer --get-volume | awk '{print $1}' ;;
|
||||
getm*) pulsemixer --get-mute ;;
|
||||
*) help ;;
|
||||
esac
|
||||
|
||||
+27
-27
@@ -9,33 +9,33 @@ START="$DIR/start"
|
||||
OPT="$DIR/opt"
|
||||
|
||||
help() {
|
||||
BOLD=$(tput bold)
|
||||
NORMAL=$(tput sgr0)
|
||||
B=$(tput bold)
|
||||
N=$(tput sgr0)
|
||||
|
||||
echo "${BOLD}NAME${NORMAL}"
|
||||
echo " vimplugin - vim plugin manager"
|
||||
echo ""
|
||||
echo "${BOLD}SYNOPSIS${NORMAL}"
|
||||
echo " ./vimplugin.sh <command> [<arg1> <arg2>]"
|
||||
echo ""
|
||||
echo "${BOLD}COMMANDS${NORMAL}"
|
||||
echo " init"
|
||||
echo " Creates all the required directories/files."
|
||||
echo ""
|
||||
echo " install <url> [\"start\"/\"opt\"]"
|
||||
echo " Install a new plugin, <url> need to be a valid \
|
||||
GitHub URL,
|
||||
start/opt to install the plugin in the start/opt directory \
|
||||
(default: start)."
|
||||
echo ""
|
||||
echo " list <number>"
|
||||
echo " Prints all the installed plugins, <number> prints \
|
||||
just the plugin in that position."
|
||||
echo " remove"
|
||||
echo " Remove plugin, script will prompt a selection menu."
|
||||
echo " update"
|
||||
echo " Installs/updates all plugins from the config file."
|
||||
echo ""
|
||||
cat << EOF
|
||||
${B}NAME${N}
|
||||
vimplugin - vim plugin manager
|
||||
|
||||
${B}SYNOPSIS${N}
|
||||
./vimplugin.sh <command> [<arg1> <arg2>]
|
||||
|
||||
${B}COMMANDS${N}
|
||||
${B}init${N}
|
||||
Creates all the required directories/files.
|
||||
|
||||
${B}install <url> ["start"/"opt"]${N}
|
||||
Install a new plugin, <url> need to be a valid GitHub URL,
|
||||
start/opt to install the plugin in the start/opt directory
|
||||
(default: start).
|
||||
|
||||
${B}list <number>${N}
|
||||
Prints all the installed plugins,
|
||||
<number> prints just the plugin in that position.
|
||||
${B}remove${N}
|
||||
Remove plugin, script will prompt a selection menu.
|
||||
${B}update${N}
|
||||
Installs/updates all plugins from the config file.
|
||||
EOF
|
||||
}
|
||||
|
||||
init() {
|
||||
@@ -146,6 +146,6 @@ remove() {
|
||||
if type "$1" 2> /dev/null | grep -q "function"; then
|
||||
"$@"
|
||||
else
|
||||
echo "script: command not found: $1"
|
||||
help
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user