Skip to content

Commit e72184c

Browse files
authored
feat(scripts): improve test env setup messaging (#3214)
Update setup_test_env.sh to enhance messaging for environment activation and local testnet startup. Adds clearer instructions and visual cues for better user experience.
1 parent f844d38 commit e72184c

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

scripts/setup_test_env.sh

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
if [ -z "${IN_NIX_SHELL:-""}" ]; then
44
echo "This script is supposed to be run from nix shell." >&2
@@ -21,11 +21,16 @@ case "${1:-""}" in
2121
;;
2222
esac
2323

24+
ORIG_PWD="$PWD"
2425
REPODIR="$(readlink -m "${0%/*}/..")"
25-
cd "$REPODIR" || exit 1
26-
2726
export WORKDIR="$REPODIR/dev_workdir"
2827

28+
if [ "$ORIG_PWD" = "$WORKDIR" ]; then
29+
echo "Please run this script from outside of '$WORKDIR'" >&2
30+
exit 1
31+
fi
32+
33+
cd "$REPODIR" || exit 1
2934
rm -rf "${WORKDIR:?}"
3035
mkdir -p "${WORKDIR}/tmp"
3136

@@ -62,15 +67,21 @@ EoF
6267
source "$WORKDIR/.source"
6368
prepare-cluster-scripts -d "$WORKDIR/${CLUSTER_ERA}_fast" -t "${CLUSTER_ERA}_fast"
6469

70+
# Compute a relative path only if WORKDIR is under ORIG_PWD
71+
if [[ "$WORKDIR" == "$ORIG_PWD"* ]]; then
72+
REL_WORKDIR="./${WORKDIR#"$ORIG_PWD"/}"
73+
else
74+
REL_WORKDIR="$WORKDIR"
75+
fi
76+
6577
echo
78+
echo "========================================"
79+
echo " 🚀 Test Environment Ready"
80+
echo "========================================"
6681
echo
67-
echo "------------------------"
68-
echo "| Test Env Ready |"
69-
echo "------------------------"
70-
echo
71-
echo "To activate it, source the env with:"
72-
echo "source $WORKDIR/.source"
82+
echo "👉 Activate the environment:"
83+
echo " source $REL_WORKDIR/.source"
7384
echo
74-
echo "To start local testnet, run:"
75-
echo "$WORKDIR/${CLUSTER_ERA}_fast/start-cluster"
85+
echo "👉 Start the local testnet:"
86+
echo " $REL_WORKDIR/${CLUSTER_ERA}_fast/start-cluster"
7687
echo

0 commit comments

Comments
 (0)