Commit d438d418abc99ae783e756a69a4b23f1670a21b6

Thomas de Grivel 2023-01-27T14:05:20

console output

diff --git a/share/shpkg/shpkg.subr b/share/shpkg/shpkg.subr
index e87f9bf..03f98e5 100644
--- a/share/shpkg/shpkg.subr
+++ b/share/shpkg/shpkg.subr
@@ -3,6 +3,27 @@
 
 set -e
 
+# Console output
+err () {
+    R="$1"
+    shift
+    printf '\33[0;31m' >&2
+    echo -n "$0:" error: "$@" >&2
+    printf '\33[0m\n' >&2
+    exit "$R"
+}
+
+puts () {
+    printf '\33[0;34m'
+    echo -n "$@"
+    printf '\33[0m\n'
+}
+
+verbose () {
+    puts "$@"
+    "$@"
+}
+
 # Config
 SHPKG_DIR="${SHPKG_DIR:-${HOME}/shpkg}"
 
@@ -53,26 +74,6 @@ export CPPFLAGS="${CPPFLAGS} -I${SHPKG_INCLUDE_DIR}"
 export LDFLAGS="${LDFLAGS} -L${SHPKG_LIB_DIR}"
 export PKG_CONFIG_PATH="${SHPKG_LIB_DIR}/pkgconfig"
 
-puts() {
-    printf '\33[0;34m'
-    echo -n "$@"
-    printf '\33[0m\n'
-}
-
-err() {
-    R="$1"
-    shift
-    printf '\33[0;31m' >&2
-    echo -n "$0:" error: "$@" >&2
-    printf '\33[0m\n' >&2
-    exit "$R"
-}
-
-verbose() {
-    puts "$@"
-    "$@"
-}
-
 # Setup
 if ! [ -d "${SHPKG_FAKE_DIR}" ]; then
     verbose mkdir -p "${SHPKG_FAKE_DIR}"