Skip to content

Commit 177b357

Browse files
committed
Fixed quoting bug introduced in cli upgrade for jsoncols
1 parent d84cd77 commit 177b357

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

cmds/jsoncols/jsoncols.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,14 @@ func main() {
233233
default:
234234
src, err := json.Marshal(result)
235235
cli.ExitOnError(app.Eout, err, quiet)
236-
if quote == true {
237-
fmt.Fprintf(app.Out, "%q", src)
238-
} else {
239-
fmt.Fprintf(app.Out, "%s", src)
240-
}
236+
/*
237+
if quote == true {
238+
fmt.Fprintf(app.Out, "%q", src)
239+
} else {
240+
fmt.Fprintf(app.Out, "%s", src)
241+
}
242+
*/
243+
fmt.Fprintf(app.Out, "%s", src)
241244
}
242245
}
243246
}

datatools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
)
3636

3737
const (
38-
Version = `v0.0.20-pre`
38+
Version = `v0.0.21-pre`
3939

4040
LicenseText = `
4141
%s %s

test_cmds.bash

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,20 @@ function test_jsoncols(){
547547
R=$(cmp how-to/jsoncols/result3.txt temp.txt)
548548
assert_empty "test_jsoncols (result3)" "$R"
549549

550+
E="1"
551+
R=$(bin/jsoncols -i how-to/jsoncols/blob2.json '.id')
552+
assert_equal "test_jsoncols (.id)" "$E" "$R"
553+
E="8"
554+
R=$(bin/jsoncols -i how-to/jsoncols/blob2.json '.counts[2]')
555+
assert_equal "test_jsoncols (.counts[2])" "$E" "$R"
556+
E="2"
557+
R=$(bin/jsoncols -i how-to/jsoncols/blob2.json '.map.two')
558+
assert_equal "test_jsoncols (.map.two)" "$E" "$R"
559+
E='{"one":1,"two":2,"three":3}'
560+
R=$(bin/jsoncols -i how-to/jsoncols/blob2.json '.map')
561+
assert_equal "test_jsoncols (.map)" "$E" "$R"
562+
563+
550564
if [ -f temp.txt ]; then rm temp.txt; fi
551565
echo "test_jsoncols OK";
552566
}

0 commit comments

Comments
 (0)