From 1937426dcb2042073aec99d7fac84e7f2353d837 Mon Sep 17 00:00:00 2001 From: b1ek Date: Wed, 14 Feb 2024 12:21:28 +1000 Subject: [PATCH] (fix) isolate listing command as well --- brick.sh | 20 ++++++++++++++------ bricks/example.brick | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/brick.sh b/brick.sh index feb301b..77e5689 100755 --- a/brick.sh +++ b/brick.sh @@ -75,6 +75,10 @@ tmpdir() { echo $BRICKS_DB/.tmp } +exec_brick() { + echo -e "$(bricksenv)\n$*" | bash +} + # checking that brick's dependencies are installed BRICK_DEPS=(curl) NO_DEPS=() @@ -126,8 +130,16 @@ while [[ $# -gt 0 ]]; do -L) inf "listing packages" for pkg in $(find $BRICKS_DIR -maxdepth 1 -type f -printf "%f\n" | grep -E \\.brick$ | sed 's/.brick//'); do - source $(getbrick $pkg) - inf "$(inf "$pkg - $(info)")" + SCRIPT="\n + source $(getbrick $pkg)\n + if [ \"\$(command -v info)\" == \"info\" ]; then\n + echo \$(info)\n + else\n + echo 'no info provided'\n + fi\n + " +# exec_brick $SCRIPT + inf "$(inf "$pkg - $(exec_brick $SCRIPT)")" done inf 'done' exit 0 @@ -233,10 +245,6 @@ i=1 # pacman deps installed, lets install the actual shit for pkg in "${PKGS[@]}"; do - exec_brick() { - echo -e "$(bricksenv)$1" | bash - } - # first check if there is stuff we need to download for that brick SCRIPT=" diff --git a/bricks/example.brick b/bricks/example.brick index 729ccc9..af9d2d8 100644 --- a/bricks/example.brick +++ b/bricks/example.brick @@ -9,7 +9,7 @@ downloads=( ) info() { - echo this brick does this and that + echo a reference example } license() {