Add help message

This commit is contained in:
gardouille 2020-12-01 18:04:51 +01:00
parent c80f2b30b7
commit 1c3370f68a
Signed by: gardouille
GPG Key ID: E759BAA22501AF32

View File

@ -1,8 +1,11 @@
#!/bin/sh
## Try to use flameshot to get a screenshot
### Select area work with both NORMAL and DELAYED_MODE.
### See https://github.com/flameshot-org/flameshot
## Or try to use scrot
### Select area work only in normal mode.
### In DELAYED_MODE, a capture of all screens is made.
# Vars {{{
readonly PROGNAME=$(basename "${0}")
@ -15,6 +18,34 @@ readonly RED='\033[0;31m'
readonly RESET='\033[0m'
readonly COLOR_DEBUG="${PURPLE}"
# }}}
usage() { # {{{
cat <<- EOF
usage: $PROGNAME [--help] [--delay INT_DELAY_SECONDS] [INT_DELAY_SECONDS]
Try to get a screen capture with available tool:
1. Flameshot (see: https://github.com/flameshot-org/flameshot)
2. Scrot
EXAMPLES:
- Select the area, on the screen, to capture
${PROGNAME}
- Wait 5 seconds before launching the capture tool
${PROGNAME} 5
${PROGNAME} --delay 5
OPTIONS:
-d,--delay INT_DELAY_SECONDS
Wait INT_DELAY_SECONDS before launching capture tool
--help
Print this help message.
EOF
}
# }}}
debug_message() { # {{{
local_debug_message="${1}"
@ -59,9 +90,15 @@ if [ ! "${NBARGS}" -eq "0" ]; then
## Define the delay with this argument (in seconds)
delay_screenshot="${1}"
;;
-h|--help ) ## help
usage
## Exit after help informations
exit 0
;;
* ) ## unknow option
printf '%b\n' "${RED}Invalid option: ${1}${RESET}"
printf '%b\n' "---"
usage
exit 1
;;
esac