Update batwatch to show errors outside the pager

This commit is contained in:
Ethan P 2019-09-26 16:08:44 -07:00
parent a63609e173
commit 33ebf07bbd
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA

View File

@ -124,21 +124,23 @@ fi
# -----------------------------------------------------------------------------
# Main:
# -----------------------------------------------------------------------------
main() {
# Determine the watcher.
if [[ -z "$OPT_WATCHER" ]]; then
OPT_WATCHER="$(determine_watcher)"
if [[ $? -ne 0 ]]; then
printc "%{RED}[%s error]%{CLEAR}: Your system does not have any supported watchers.\n" "$PROGRAM" 1>&2
printc "Please read the documentation at {BLUE}%s%{CLEAR} for more details.\n" "$DOCS_URL/batwatch.md" 1>&2
return 2
exit 2
fi
fi
if ! type "watcher_${OPT_WATCHER}_supported" &>/dev/null; then
printc "%{RED}[%s error]%{CLEAR}: Unknown watcher: '%s'\n" "$PROGRAM" "$OPT_WATCHER" 1>&2
return 1
exit 1
fi
# Run the main function.
main() {
"watcher_${OPT_WATCHER}_watch" "${FILES[@]}"
return $?
}