 "  `basename $0` -f THEMEFILE"
	echo "  `basename $0` --save [THEME|THEMEFILE]"
	echo "  `basename $0` [-t|-p|-%] IMAGE"
	echo "  `basename $0` [-s|-S] [PATTERNS]"
	echo "  `basename $0` [-d] -q > THEMEFILE"
	echo "List/set/query mintty themes in current mintty window."
	echo "A theme is a colour scheme to configure the 8 ANSI colours, their "
	echo "bright versions, and optionally the foreground/background/cursor colours."
	echo
	echo "Arguments:"
	echo "  THEME                     set theme from config resources"
	echo "  -f, --file THEMEFILE      set theme from themefile"
	echo "  --save [THEME|THEMEFILE]  save theme also in config file"
	echo "  -t, --texture FILE[,DIM]  set background texture (dim 1..255)"
	echo "  -p, --picture FILE[,DIM]  set background picture (dim 1..255)"
	echo "  -%, --picscale FILE[,DIM] like -p and scale window"
	echo "  -q, --query               query current colour configuration as theme"
	echo "  -d, --decimal             decimal query output"
	echo "  -l, --list                list available themes"
	echo "  -s, --show [PATTERN...]   show (visualize) themes [matching PATTERNs]"
	echo "  -S, --Show [PATTERN...]   show themes double-lined [matching PATTERNs]"
	echo "  -h, --help                show this"
	echo
	echo "The following directories are considered for locating configured themes:"
	echo '  ~/.mintty'
	echo '  ~/.config/mintty'
	echo '  $APPDATA/mintty'
	echo '  /usr/share/mintty'
	echo "Note that the command-line option --configdir cannot be considered."
}

terminaltype () {
case "$BASH" in
?*)	# try simplified query as suggested by Brian Inglis:
	# https://github.com/mintty/mintty/issues/776#issuecomment-475761566
	read -s -dc -p $'\E[>c' da < /dev/tty
	da=${da##$'\E'[>}
	set - ${da//;/ }
	;;
*)	# other shells do not have flexible read and string operations
	# so it's a bit more tricky...
	test -t 0 && stty=`stty -g`
	test -t 0 && stty raw -echo min 0 time 5

	echo -n "