fix(booth): CLI resolves its source through the ~/.local/bin symlink (readlink -f), so ask/asks/answer/unlink work from any cwd
This commit is contained in:
@@ -184,7 +184,7 @@ case "$cmd" in
|
||||
esac
|
||||
# `|| exit 1` so a failure is reported rather than swallowed; `set -e` inside
|
||||
# a command substitution elsewhere in this script has bitten us already.
|
||||
BOOTH_SRC="$(cd "$(dirname -- "$0")/.." && pwd)" python3 -c '
|
||||
BOOTH_SRC="$(cd "$(dirname -- "$(readlink -f -- "$0")")/.." && pwd)" python3 -c '
|
||||
import os, pathlib, sys
|
||||
sys.path.insert(0, os.environ["BOOTH_SRC"])
|
||||
from booth.links import remove_link_entry # stdlib only — no venv needed
|
||||
@@ -205,7 +205,7 @@ print("removed: %s %s" % (removed["desc"], removed["url"]))
|
||||
[ "${#opts[@]}" -ge 2 ] || { echo "an ask needs at least 2 options" >&2; exit 1; }
|
||||
# Validated through the SAME normaliser the page uses, so a session cannot
|
||||
# post a question the renderer would refuse. stdlib only — no venv needed.
|
||||
BOOTH_SRC="$(cd "$(dirname -- "$0")/.." && pwd)" ASK_NOTES="$notes" python3 -c '
|
||||
BOOTH_SRC="$(cd "$(dirname -- "$(readlink -f -- "$0")")/.." && pwd)" ASK_NOTES="$notes" python3 -c '
|
||||
import os, pathlib, sys
|
||||
sys.path.insert(0, os.environ["BOOTH_SRC"])
|
||||
from booth.asks import AskError, write_ask
|
||||
@@ -219,7 +219,7 @@ except AskError as exc:
|
||||
;;
|
||||
asks)
|
||||
[ $# -ge 1 ] || usage
|
||||
BOOTH_SRC="$(cd "$(dirname -- "$0")/.." && pwd)" python3 -c '
|
||||
BOOTH_SRC="$(cd "$(dirname -- "$(readlink -f -- "$0")")/.." && pwd)" python3 -c '
|
||||
import os, pathlib, sys
|
||||
sys.path.insert(0, os.environ["BOOTH_SRC"])
|
||||
from booth.asks import list_asks
|
||||
|
||||
Reference in New Issue
Block a user