This commit is contained in:
Jordan Harband 2024-06-10 15:16:40 -07:00
parent c30ed0b1d3
commit 207465dd36
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56

View File

@ -125,15 +125,11 @@ nvm_json_awk_egrep() {
nvm_json_tokenize() {
local GREP
GREP='grep -Eao'
local ESCAPE
local CHAR
if echo 'test string' | grep -Eao --color=never 'test' > /dev/null 2>&1; then
GREP='grep -Eao --color=never'
else
GREP='grep -Eao'
fi
if echo "test string" | grep -Eo "test" > /dev/null 2>&1; then
ESCAPE='(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR='[^[:cntrl:]"\\]'
@ -152,7 +148,7 @@ nvm_json_tokenize() {
local SPACE
SPACE='[[:space:]]+'
$GREP "${STRING}|${NUMBER}|${KEYWORD}|${SPACE}|." | grep -Ev "^${SPACE}$"
$GREP "${STRING}|${NUMBER}|${KEYWORD}|${SPACE}|." | TERM=dumb grep -Ev "^${SPACE}$"
}
_json_parse_array() {