From 25a0130e81309bde06f7926e00f89af2bb6f73c1 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Fri, 1 May 2020 11:08:28 +0200 Subject: [PATCH] grimshot: Show usage when on invalid command Show the usage output when an invalid command is received. Otherwise things like `grimshot --help` save a screenshot, which is really unexpected and hurts users trying to remember the right commands / arguments. --- contrib/grimshot | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/contrib/grimshot b/contrib/grimshot index 028fd935e..6b94cb445 100755 --- a/contrib/grimshot +++ b/contrib/grimshot @@ -30,11 +30,23 @@ ACTION=${1:-usage} SUBJECT=${2:-screen} FILE=${3:-$(getTargetDirectory)/$(date -Ins).png} -if [ "$ACTION" = "usage" ] ; then +if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then echo "Usage:" - echo " grimshot copy|save win|screen|output|area [FILE]" - echo "Troubleshoot:" + echo " grimshot (copy|save) [win|screen|output|area] [FILE]" echo " grimshot check" + echo " grimshot usage" + echo "" + echo "Commands:" + echo " copy: Copy the screenshot data into the clipboard." + echo " save: Save the screenshot to a regular file." + echo " check: Verify if required tools are installed and exit." + echo " usage: Show this message and exit." + echo "" + echo "Targets:" + echo " win: Currently active window." + echo " screen: All visible outputs." + echo " output: Currently active output." + echo " region: Manually select a region." exit fi