diff options
| author | Matt Pocock <mattpocockvoice@gmail.com> | 2026-10-13 09:46:39 +0100 |
|---|---|---|
| committer | Matt Pocock <mattpocockvoice@gmail.com> | 2026-10-13 09:46:39 +0100 |
| commit | c20facd6ed20a9697335354ab15585415216a43a (patch) | |
| tree | 80397fdff7e9418f117db2289f62f2faa3547b1d | |
| parent | 49dd158d1076134a641b33efb035946536778336 (diff) | |
wizard: keep apostrophes intact on bash 3.2 when Enter keeps currentwizard-bash32-apostrophe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | .changeset/wizard-bash32-apostrophe.md | 5 | ||||
| -rw-r--r-- | skills/engineering/wizard/template.sh | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/.changeset/wizard-bash32-apostrophe.md b/.changeset/wizard-bash32-apostrophe.md new file mode 100644 index 0000000..6ffda4d --- /dev/null +++ b/.changeset/wizard-bash32-apostrophe.md @@ -0,0 +1,5 @@ +--- +"mattpocock-skills": patch +--- + +`wizard` keeps apostrophe values intact on bash 3.2 when Enter keeps the current value (#1260). diff --git a/skills/engineering/wizard/template.sh b/skills/engineering/wizard/template.sh index 081ed3d..8d8c4d0 100644 --- a/skills/engineering/wizard/template.sh +++ b/skills/engineering/wizard/template.sh @@ -93,9 +93,9 @@ confirm() { # quotes or a plain dotenv double-quoted value undone. _existing() { [[ -f "$ENV_FILE" ]] || return 1 - local line value sq="'\\''"; line=$(grep -E "^${1}=" "$ENV_FILE" | tail -n1) || return 1 + local line value sq="'\\''" q="'"; line=$(grep -E "^${1}=" "$ENV_FILE" | tail -n1) || return 1 value="${line#*=}" - if [[ "$value" == \'*\' ]]; then value="${value:1:${#value}-2}"; value="${value//"$sq"/\'}" + if [[ "$value" == \'*\' ]]; then value="${value:1:${#value}-2}"; value="${value//"$sq"/$q}" elif [[ "$value" == \"*\" ]]; then value="${value:1:${#value}-2}" [[ "$value" == *[\\\$\"]* ]] && return 1 # escapes, $ or ": can't decode safely; ask again |
