refactor: use pure zsh for JSON parsing instead of awk
Replace awk-based JSON parsing with native zsh regex matching and file reading. This removes the external command dependency and is slightly faster. Made-with: Cursor
This commit is contained in:
parent
eca86908eb
commit
f076985c57
|
|
@ -1682,8 +1682,10 @@
|
||||||
dir=${dir:h}
|
dir=${dir:h}
|
||||||
done
|
done
|
||||||
[[ -z $sf_config ]] && return
|
[[ -z $sf_config ]] && return
|
||||||
local org
|
local content
|
||||||
org=$(command awk -F'"' '/target-org/{print $4}' "$sf_config" 2>/dev/null)
|
content=$(<"$sf_config") || return
|
||||||
|
[[ $content =~ '"target-org"[[:space:]]*:[[:space:]]*"([^"]*)"' ]] || return
|
||||||
|
local org=$match[1]
|
||||||
[[ -z $org ]] && return
|
[[ -z $org ]] && return
|
||||||
p10k segment -b 4 -f 255 -i $'\uf0c2' -t "$org"
|
p10k segment -b 4 -f 255 -i $'\uf0c2' -t "$org"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1657,8 +1657,10 @@
|
||||||
dir=${dir:h}
|
dir=${dir:h}
|
||||||
done
|
done
|
||||||
[[ -z $sf_config ]] && return
|
[[ -z $sf_config ]] && return
|
||||||
local org
|
local content
|
||||||
org=$(command awk -F'"' '/target-org/{print $4}' "$sf_config" 2>/dev/null)
|
content=$(<"$sf_config") || return
|
||||||
|
[[ $content =~ '"target-org"[[:space:]]*:[[:space:]]*"([^"]*)"' ]] || return
|
||||||
|
local org=$match[1]
|
||||||
[[ -z $org ]] && return
|
[[ -z $org ]] && return
|
||||||
p10k segment -b 4 -f 255 -i $'\uf0c2' -t "$org"
|
p10k segment -b 4 -f 255 -i $'\uf0c2' -t "$org"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1657,8 +1657,10 @@
|
||||||
dir=${dir:h}
|
dir=${dir:h}
|
||||||
done
|
done
|
||||||
[[ -z $sf_config ]] && return
|
[[ -z $sf_config ]] && return
|
||||||
local org
|
local content
|
||||||
org=$(command awk -F'"' '/target-org/{print $4}' "$sf_config" 2>/dev/null)
|
content=$(<"$sf_config") || return
|
||||||
|
[[ $content =~ '"target-org"[[:space:]]*:[[:space:]]*"([^"]*)"' ]] || return
|
||||||
|
local org=$match[1]
|
||||||
[[ -z $org ]] && return
|
[[ -z $org ]] && return
|
||||||
p10k segment -b 4 -f 255 -i $'\uf0c2' -t "$org"
|
p10k segment -b 4 -f 255 -i $'\uf0c2' -t "$org"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1775,8 +1775,10 @@
|
||||||
dir=${dir:h}
|
dir=${dir:h}
|
||||||
done
|
done
|
||||||
[[ -z $sf_config ]] && return
|
[[ -z $sf_config ]] && return
|
||||||
local org
|
local content
|
||||||
org=$(command awk -F'"' '/target-org/{print $4}' "$sf_config" 2>/dev/null)
|
content=$(<"$sf_config") || return
|
||||||
|
[[ $content =~ '"target-org"[[:space:]]*:[[:space:]]*"([^"]*)"' ]] || return
|
||||||
|
local org=$match[1]
|
||||||
[[ -z $org ]] && return
|
[[ -z $org ]] && return
|
||||||
p10k segment -b 4 -f 255 -i $'\uf0c2' -t "$org"
|
p10k segment -b 4 -f 255 -i $'\uf0c2' -t "$org"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue