mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-28 07:43:31 +02:00
fix(claude_desktop): keep the final tokensave path from bashio::config
bashio::config prints its result via printf without a trailing newline, so a plain while-read loop drops the last (often only) configured project path and no TokenSave repository would be initialized. Use the read || [ -n ... ] idiom in the three path loops so the final unterminated record is still processed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KN8i26JrKSaBdvTrpVEyQ6
This commit is contained in:
@@ -8,7 +8,9 @@ if ! bashio::config.true 'install_tokensave' || ! command -v git > /dev/null 2>&
|
||||
fi
|
||||
|
||||
declare -A REPOS_SEEN=()
|
||||
while IFS= read -r configured_path; do
|
||||
# bashio::config prints its result without a trailing newline, so the last record arrives
|
||||
# with read returning non-zero; the extra test keeps that final path in the loop.
|
||||
while IFS= read -r configured_path || [ -n "$configured_path" ]; do
|
||||
configured_path="${configured_path#"${configured_path%%[![:space:]]*}"}"
|
||||
configured_path="${configured_path%"${configured_path##*[![:space:]]}"}"
|
||||
if [ -z "$configured_path" ] || [ "$configured_path" = "null" ]; then
|
||||
|
||||
@@ -167,7 +167,9 @@ PY
|
||||
# requires one-time per-project opt-in; an empty list therefore has no startup or storage cost.
|
||||
if $TOKENSAVE_ENABLED; then
|
||||
declare -A TOKENSAVE_REPOS_SEEN=()
|
||||
while IFS= read -r configured_path; do
|
||||
# bashio::config prints its result without a trailing newline, so the last record arrives
|
||||
# with read returning non-zero; the extra test keeps that final path in the loop.
|
||||
while IFS= read -r configured_path || [ -n "$configured_path" ]; do
|
||||
# Trim surrounding whitespace while preserving spaces inside paths.
|
||||
configured_path="${configured_path#"${configured_path%%[![:space:]]*}"}"
|
||||
configured_path="${configured_path%"${configured_path##*[![:space:]]}"}"
|
||||
|
||||
@@ -149,7 +149,7 @@ section "TokenSave"
|
||||
if bashio::config.true 'install_tokensave'; then
|
||||
tokensave doctor --agent claude || true
|
||||
tokensave gain --all --range 30d || true
|
||||
while IFS= read -r configured_path; do
|
||||
while IFS= read -r configured_path || [ -n "$configured_path" ]; do
|
||||
if [ -z "$configured_path" ] || [ "$configured_path" = "null" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user