Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 10, 2024
1 parent c30ed0b commit 207465d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions test/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:]"\\]'
Expand All @@ -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() {
Expand Down

0 comments on commit 207465d

Please sign in to comment.