mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									61d59180b8
								
							
						
					
					
						commit
						25a0130e81
					
				
					 1 changed files with 15 additions and 3 deletions
				
			
		| 
						 | 
					@ -30,11 +30,23 @@ ACTION=${1:-usage}
 | 
				
			||||||
SUBJECT=${2:-screen}
 | 
					SUBJECT=${2:-screen}
 | 
				
			||||||
FILE=${3:-$(getTargetDirectory)/$(date -Ins).png}
 | 
					FILE=${3:-$(getTargetDirectory)/$(date -Ins).png}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$ACTION" = "usage" ] ; then
 | 
					if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
 | 
				
			||||||
  echo "Usage:"
 | 
					  echo "Usage:"
 | 
				
			||||||
  echo "  grimshot copy|save win|screen|output|area [FILE]"
 | 
					  echo "  grimshot (copy|save) [win|screen|output|area] [FILE]"
 | 
				
			||||||
  echo "Troubleshoot:"
 | 
					 | 
				
			||||||
  echo "  grimshot check"
 | 
					  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
 | 
					  exit
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue