Skip to content

Commit 702ceba

Browse files
committed
fix: missing output when iterating over the rows
1 parent a06e328 commit 702ceba

37 files changed

+90
-258
lines changed

INSTALL.html

-223
This file was deleted.

cmd/jsonobjects2csv/jsonobjects2csv.go

+24-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ var (
4343
4444
{app_name} is a tool that converts a JSON list of objects into CSV output.
4545
46+
{app_name} will take JSON expressing a list of objects and turn them into a CSV
47+
representation. If the object's attributes include other objects or arrays they
48+
are rendered as YAML in the cell of the csv output.
49+
4650
# OPTIONS
4751
4852
-help
@@ -78,9 +82,28 @@ var (
7882
7983
# EXAMPLES
8084
81-
These would get the file named "my_list.json" and save it as my.csv
85+
Used by typing into standard in (press Ctrl-d to end your input).
86+
87+
~~~shell
88+
{app_name}
89+
[
90+
{"one": 1, "two": 2},
91+
{"one": 10, "two": 20},
92+
]
93+
^D
94+
~~~
8295
96+
This should yield the following.
97+
98+
~~~text
99+
one,two
100+
1,2
101+
10,20
83102
~~~
103+
104+
These would get the file named "my_list.json" and save it as my.csv
105+
106+
~~~shell
84107
{app_name} my_list.json > my.csv
85108
86109
{app_name} my_list.json my.csv

codemeta2cff.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%codemeta2cff(1) user manual | version 1.2.9 0d7364a
1+
%codemeta2cff(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

csv.go

+7
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ func JSONObjectsToCSV(in io.Reader, out io.Writer, eout io.Writer, quiet bool, s
241241
}
242242
}
243243
row := []string{}
244+
fmt.Fprintf(eout, "DEBUG object list length %d\n", len(objList))
244245
for i, obj := range objList {
245246
// clear the row before proceeding.
246247
row = []string{}
248+
// assemble the row by appending "cells"
247249
for j, col_name := range header {
248250
if val, ok := obj[col_name]; ok {
249251
cell := ""
@@ -275,6 +277,11 @@ func JSONObjectsToCSV(in io.Reader, out io.Writer, eout io.Writer, quiet bool, s
275277
row = append(row, "")
276278
}
277279
}
280+
if err = w.Write(row); err != nil {
281+
if ! quiet {
282+
fmt.Fprintf(eout, "failed to write row %d, %+v\n", len(objList)+1, row)
283+
}
284+
}
278285
}
279286
if err = w.Write(row); err != nil {
280287
if ! quiet {

csv2json.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%csv2json(1) user manual | version 1.2.9 0d7364a
1+
%csv2json(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

csv2mdtable.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%csv2mdtable(1) user manual | version 1.2.9 0d7364a
1+
%csv2mdtable(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

csv2tab.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%csv2tab(1) user manual | version 1.2.9 0d7364a
1+
%csv2tab(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

csv2xlsx.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%csv2xlsx(1) user manual | version 1.2.9 0d7364a
1+
%csv2xlsx(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

csvcleaner.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%csvcleaner(1) user manual | version 1.2.9 0d7364a
1+
%csvcleaner(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

csvcols.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%csvcols(1) user manual | version 1.2.9 0d7364a
1+
%csvcols(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

csvfind.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%csvfind(1) user manual | version 1.2.9 0d7364a
1+
%csvfind(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

csvjoin.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%csvjoin(1) user manual | version 1.2.9 0d7364a
1+
%csvjoin(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

csvrows.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%csvrows(1) user manual | version 1.2.9 0d7364a
1+
%csvrows(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

finddir.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%finddir(1) user manual | version 1.2.9 0d7364a
1+
%finddir(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

findfile.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%findfile(1) user manual | version 1.2.9 0d7364a
1+
%findfile(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

json2toml.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%json2toml(1) user manual | version 1.2.9 0d7364a
1+
%json2toml(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

json2yaml.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%json2yaml(1) user manual | version 1.2.9 0d7364a
1+
%json2yaml(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

jsoncols.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%jsoncols(1) user manual | version 1.2.9 0d7364a
1+
%jsoncols(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

jsonjoin.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%jsonjoin(1) user manual | version 1.2.9 0d7364a
1+
%jsonjoin(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

jsonmunge.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%jsonmunge(1) user manual | version 1.2.9 0d7364a
1+
%jsonmunge(1) user manual | version 1.2.9 a06e328
22
% R. S. Doiel
33
% 2024-03-06
44

0 commit comments

Comments
 (0)