File tree Expand file tree Collapse file tree 5 files changed +50
-5
lines changed
Expand file tree Collapse file tree 5 files changed +50
-5
lines changed Original file line number Diff line number Diff line change 11# Package
22
3- version = " 0.9.1 "
3+ version = " 0.9.2 "
44author = " Kaushal Modi"
55description = " Convert Helix Version Control / Perforce (p4) -ztag output to JSON"
66license = " MIT"
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ proc ztagFileToJson*(filename: string) =
180180 populateJArr (filename.lines)
181181 changeFileExt (filename, " json" ).writeFile (jArr.pretty)
182182
183- proc ztagStringToJson * (ztag : string ): string =
183+ proc ztagStringToJson * (ztagStr : string ): string =
184184 # # Convert input ztag string to JSON.
185185 # #
186186 runnableExamples:
@@ -202,7 +202,7 @@ proc ztagStringToJson*(ztag: string): string =
202202] """
203203 doAssert ztagString.ztagStringToJson () == jsonString
204204 # #
205- populateJArr (ztag .splitLines ())
205+ populateJArr (ztagStr. strip () .splitLines ())
206206 return jArr.pretty ()
207207
208208when isMainModule :
@@ -213,7 +213,7 @@ when isMainModule:
213213 # # prints the converted JSON to the stdout
214214 if not isatty (stdin):
215215 let
216- stdinData = readAll (stdin). strip ()
216+ stdinData = readAll (stdin)
217217 echo stdinData.ztagStringToJson ()
218218 else :
219219 let
Original file line number Diff line number Diff line change @@ -61,4 +61,7 @@ suite "ztag to json":
6161
6262 test " parse non-ztag data output by p4 just before the ztag stream" :
6363 doCheck (" ztag_header" )
64- doCheck (" ztag_header2" )
64+ doCheck (" ztag_header2" )
65+
66+ test " check that the trialing blank line does not convert to a newline in json string" :
67+ doCheck (" trailing_blank_line" )
Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "depotFile" : " //vqp/sykjf/om/WQJEO/datl/dx/b.pjp" ,
4+ "clientFile" : " /gopm/jvjdh/fxppl/pa/kacl/eh/a.lgn" ,
5+ "haveRev" : " none" ,
6+ "oldAction" : " add" ,
7+ "action" : " abandoned"
8+ },
9+ {
10+ "depotFile" : " //djr/spdox/qm/DDPWA/pjrr/qm/a.lex" ,
11+ "clientFile" : " /kwdr/hxyhf/aletc/eq/vayl/df/j.bgu" ,
12+ "haveRev" : " none" ,
13+ "oldAction" : " add" ,
14+ "action" : " abandoned"
15+ },
16+ {
17+ "depotFile" : " //wgx/jjaot/qy/TTBGD/ebhm/wv/e.kka" ,
18+ "clientFile" : " /dsaf/msbgb/nvdgi/lb/jtro/yf/v.xtv" ,
19+ "haveRev" : " none" ,
20+ "oldAction" : " add" ,
21+ "action" : " abandoned"
22+ }
23+ ]
Original file line number Diff line number Diff line change 1+ ... depotFile //vqp/sykjf/om/WQJEO/datl/dx/b.pjp
2+ ... clientFile /gopm/jvjdh/fxppl/pa/kacl/eh/a.lgn
3+ ... haveRev none
4+ ... oldAction add
5+ ... action abandoned
6+
7+ ... depotFile //djr/spdox/qm/DDPWA/pjrr/qm/a.lex
8+ ... clientFile /kwdr/hxyhf/aletc/eq/vayl/df/j.bgu
9+ ... haveRev none
10+ ... oldAction add
11+ ... action abandoned
12+
13+ ... depotFile //wgx/jjaot/qy/TTBGD/ebhm/wv/e.kka
14+ ... clientFile /dsaf/msbgb/nvdgi/lb/jtro/yf/v.xtv
15+ ... haveRev none
16+ ... oldAction add
17+ ... action abandoned
18+
19+
You can’t perform that action at this time.
0 commit comments