Просмотр исходного кода

Fix usage when _pretty__* called directly

exit does not work as we want in subshell, so we need to exit higher.
Alois Mahdal 9 лет назад
Родитель
Сommit
f2a8112560
1 измененных файлов: 2 добавлений и 2 удалений
  1. 2
    2
      src/include/pretty.sh

+ 2
- 2
src/include/pretty.sh Просмотреть файл

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