diff --git a/printscreen b/printscreen index bc20b01..111fc47 100755 --- a/printscreen +++ b/printscreen @@ -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