feat(help): add help function
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
fa3c7844cb
commit
374ac3aeb9
19
script
19
script
|
@ -1,7 +1,22 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf "Usage: %s [options]\n" "$0"
|
printf "Usage: %s [-h]\n" "$0"
|
||||||
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
cat << EOH
|
||||||
|
SYNOPSIS
|
||||||
|
$0 [-h]
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
$0 does things!
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
|
||||||
|
-h Show this help
|
||||||
|
EOH
|
||||||
}
|
}
|
||||||
|
|
||||||
on_interrupt() {
|
on_interrupt() {
|
||||||
|
@ -13,7 +28,7 @@ on_interrupt() {
|
||||||
main() {
|
main() {
|
||||||
while getopts "hf:" option; do
|
while getopts "hf:" option; do
|
||||||
case "${option}" in
|
case "${option}" in
|
||||||
h) usage; exit 0;;
|
h) help; exit 0;;
|
||||||
f) FOO="$OPTARG";;
|
f) FOO="$OPTARG";;
|
||||||
*) usage; exit 1;;
|
*) usage; exit 1;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue