Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Simple CLI wrapper that discovers scripts in the commands/ directory

# Cd to the directory of this script, so it can be run from anywhere
cd "$(dirname "$0")" || exit 1
cd "$(dirname "$(realpath "$0")")" || exit 1

# Color codes
RESET="\e[0m"
Expand Down
13 changes: 13 additions & 0 deletions tests/test-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ PROJECT_ROOT="$(dirname "$(dirname "$(realpath "$0")")")"
cleanup() {
rm "$PROJECT_ROOT/$TEST_CMD_PATH" || true
rm "$PROJECT_ROOT/$HELP_TXT_PATH" || true
rm "$PROJECT_ROOT/tests/cli-symlink.sh" || true
}
trap cleanup EXIT

Expand Down Expand Up @@ -45,6 +46,18 @@ cd ..
echo "OK"
echo

echo "Testing cli.sh as a symlink from tests directory, to proove that it can be run as a symlink from anywhere..."
cd tests
ln -s ../cli.sh ./cli-symlink.sh
OUT=$(./cli-symlink.sh)
if [[ "$OUT" != *"$TEST_CMD"* ]]; then
echo "FAIL: Test command $TEST_CMD not found when running cli.sh as a symlink from tests dir"
exit 1
fi
cd ..
echo "OK"
echo

echo "Testing cli.sh list sub-command to check output..."
OUT=$(./cli.sh list)
if [[ "$OUT" != *"$TEST_CMD"* ]]; then
Expand Down