diff options
author | 2020-05-01 11:08:28 +0200 | |
---|---|---|
committer | 2020-05-05 20:18:19 +0200 | |
commit | 25a0130e81309bde06f7926e00f89af2bb6f73c1 (patch) | |
tree | 6a4274a4bd5633caed15ac0e5c23744ca587dc97 /contrib | |
parent | grimshot: Avoid screenshots overwriting each other (diff) | |
download | sway-25a0130e81309bde06f7926e00f89af2bb6f73c1.tar.gz sway-25a0130e81309bde06f7926e00f89af2bb6f73c1.tar.zst sway-25a0130e81309bde06f7926e00f89af2bb6f73c1.zip |
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.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/grimshot | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/contrib/grimshot b/contrib/grimshot index 028fd935..6b94cb44 100755 --- a/contrib/grimshot +++ b/contrib/grimshot | |||
@@ -30,11 +30,23 @@ ACTION=${1:-usage} | |||
30 | SUBJECT=${2:-screen} | 30 | SUBJECT=${2:-screen} |
31 | FILE=${3:-$(getTargetDirectory)/$(date -Ins).png} | 31 | FILE=${3:-$(getTargetDirectory)/$(date -Ins).png} |
32 | 32 | ||
33 | if [ "$ACTION" = "usage" ] ; then | 33 | if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then |
34 | echo "Usage:" | 34 | echo "Usage:" |
35 | echo " grimshot copy|save win|screen|output|area [FILE]" | 35 | echo " grimshot (copy|save) [win|screen|output|area] [FILE]" |
36 | echo "Troubleshoot:" | ||
37 | echo " grimshot check" | 36 | echo " grimshot check" |
37 | echo " grimshot usage" | ||
38 | echo "" | ||
39 | echo "Commands:" | ||
40 | echo " copy: Copy the screenshot data into the clipboard." | ||
41 | echo " save: Save the screenshot to a regular file." | ||
42 | echo " check: Verify if required tools are installed and exit." | ||
43 | echo " usage: Show this message and exit." | ||
44 | echo "" | ||
45 | echo "Targets:" | ||
46 | echo " win: Currently active window." | ||
47 | echo " screen: All visible outputs." | ||
48 | echo " output: Currently active output." | ||
49 | echo " region: Manually select a region." | ||
38 | exit | 50 | exit |
39 | fi | 51 | fi |
40 | 52 | ||