From 1c3370f68a69a2fc4a792d9225d8e6e275a740ae Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 1 Dec 2020 18:04:51 +0100 Subject: [PATCH] Add help message --- printscreen | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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