diff --git a/spinner.sh b/spinner.sh index 7698148..768b40f 100755 --- a/spinner.sh +++ b/spinner.sh @@ -2,6 +2,14 @@ spinner_pid= +usage() { + local name=${0##*/} + cat <<-EOF +Usage: ${name} {options] + +Run a command with an animated spinner. +EOF +} spinner() { local chars=('\' '|' '/' '-') local c @@ -29,7 +37,7 @@ main() { spinner_pid=$! if (( $# == 0)); then - echo "Usage: spinner " + usage >&2 return 1 fi "$@"