Browse Source

Fix usage when _pretty__* called directly

exit does not work as we want in subshell, so we need to exit higher.
Alois Mahdal 9 years ago
parent
commit
f2a8112560
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/include/pretty.sh

+ 2
- 2
src/include/pretty.sh View File

241
         _pretty__is_internal && continue
241
         _pretty__is_internal && continue
242
         _pretty__is_frontend && echos "$fname" && return 0
242
         _pretty__is_frontend && echos "$fname" && return 0
243
         echo "do not call _pretty_* directly: $fname" >&2
243
         echo "do not call _pretty_* directly: $fname" >&2
244
-        exit_usage
244
+        return $FFOO_EXIT_USAGE
245
     done
245
     done
246
 }
246
 }
247
 
247
 
282
     local frontend  # who (of pretty.sh) was called (=> prettyprinter choice)
282
     local frontend  # who (of pretty.sh) was called (=> prettyprinter choice)
283
     local caller    # which user's function (or script) called it
283
     local caller    # which user's function (or script) called it
284
     local provider  # which provider (_pretty__echo_*()) to use
284
     local provider  # which provider (_pretty__echo_*()) to use
285
-    frontend="$(_pretty__get_frontend)"
285
+    frontend="$(_pretty__get_frontend)" || exit_usage
286
     caller="$(_pretty__get_caller)"
286
     caller="$(_pretty__get_caller)"
287
     test "$caller"   == "main"       && caller="$(basename "$0")"
287
     test "$caller"   == "main"       && caller="$(basename "$0")"
288
     test "$caller"   == "usage"      && frontend=mkusage
288
     test "$caller"   == "usage"      && frontend=mkusage