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:
+3
-3
@@ -184,7 +184,7 @@ case "$cmd" in
|
|||||||
esac
|
esac
|
||||||
# `|| exit 1` so a failure is reported rather than swallowed; `set -e` inside
|
# `|| exit 1` so a failure is reported rather than swallowed; `set -e` inside
|
||||||
# a command substitution elsewhere in this script has bitten us already.
|
# 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
|
import os, pathlib, sys
|
||||||
sys.path.insert(0, os.environ["BOOTH_SRC"])
|
sys.path.insert(0, os.environ["BOOTH_SRC"])
|
||||||
from booth.links import remove_link_entry # stdlib only — no venv needed
|
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; }
|
[ "${#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
|
# Validated through the SAME normaliser the page uses, so a session cannot
|
||||||
# post a question the renderer would refuse. stdlib only — no venv needed.
|
# 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
|
import os, pathlib, sys
|
||||||
sys.path.insert(0, os.environ["BOOTH_SRC"])
|
sys.path.insert(0, os.environ["BOOTH_SRC"])
|
||||||
from booth.asks import AskError, write_ask
|
from booth.asks import AskError, write_ask
|
||||||
@@ -219,7 +219,7 @@ except AskError as exc:
|
|||||||
;;
|
;;
|
||||||
asks)
|
asks)
|
||||||
[ $# -ge 1 ] || usage
|
[ $# -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
|
import os, pathlib, sys
|
||||||
sys.path.insert(0, os.environ["BOOTH_SRC"])
|
sys.path.insert(0, os.environ["BOOTH_SRC"])
|
||||||
from booth.asks import list_asks
|
from booth.asks import list_asks
|
||||||
|
|||||||
Reference in New Issue
Block a user