The solution is to check whether input is coming from a tty device. First, check whether args were given, then check tty.
if [ ! "$#" -gt 0 ] && tty -s ; then show_help exit 1 fi From the documentation for tty:
Print the file name of the terminal connected to standard input.
If there isn't a fileterminal connected to standard input, tty gives a failure exit status. And the -s option suppresses output.