mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 01:35:36 +00:00
fix: expand quoted ~ in install dir and trim trailing slashes on mirror URLs
Addresses Pullfrog review on #24; adds a fixture test for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
This commit is contained in:
parent
a142a3718f
commit
aabb00d3b7
2 changed files with 21 additions and 0 deletions
|
|
@ -190,6 +190,15 @@ main() {
|
|||
esac
|
||||
done
|
||||
|
||||
# A quoted --dir "~/bin" or IDX_INSTALL_DIR="~/bin" reaches us unexpanded.
|
||||
# shellcheck disable=SC2088 # matching a literal, unexpanded ~ on purpose
|
||||
case "$install_dir" in
|
||||
"~") install_dir="$HOME" ;;
|
||||
"~/"*) install_dir="$HOME/${install_dir#"~/"}" ;;
|
||||
esac
|
||||
github_url="${github_url%/}"
|
||||
api_url="${api_url%/}"
|
||||
|
||||
asset="$(detect_asset)"
|
||||
|
||||
tmp_dir="$(mktemp -d 2>/dev/null || mktemp -d -t idx-install)"
|
||||
|
|
|
|||
|
|
@ -178,6 +178,18 @@ else
|
|||
fail "replaces an existing install cleanly"; cat "${work}/out8" >&2
|
||||
fi
|
||||
|
||||
# 9. quoted ~ in --dir expands to HOME; trailing slash on mirror URLs is fine.
|
||||
# shellcheck disable=SC2088 # the literal ~ is the input under test
|
||||
if env IDX_GITHUB_URL="http://127.0.0.1:${port}/gh/" \
|
||||
IDX_GITHUB_API="http://127.0.0.1:${port}/api/" \
|
||||
HOME="${work}/home" \
|
||||
"$test_shell" "$installer" --dir "~/tilde-bin" >"${work}/out9" 2>&1 &&
|
||||
[[ -x "${work}/home/tilde-bin/idx" ]]; then
|
||||
pass "expands quoted ~ and tolerates trailing slashes"
|
||||
else
|
||||
fail "expands quoted ~ and tolerates trailing slashes"; cat "${work}/out9" >&2
|
||||
fi
|
||||
|
||||
if ((failures > 0)); then
|
||||
echo "install.sh tests: ${failures} failure(s) with ${test_shell}" >&2
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue