skygragon / leetcode-cli

A cli tool to enjoy leetcode!
MIT License
3.65k stars 457 forks source link

[Feature Request] Print new line in stdout of "test" command #166

Open xjj59307 opened 5 years ago

xjj59307 commented 5 years ago

test command doesn't interpret '\n' characters in stdout like follows.

> leetcode test solution.java

Input data:
[7,2,5,10,8]
2

Actual
  ✘ Runtime Error
  ✘ runtime: N/A
  ✘ answer:
  ✘ stdout: 'low:16\nhigh:32'
  ✘ error: Line 14: java.lang.ArrayIndexOutOfBoundsException: -1

stdout is very useful when debugging while all logs being printed in a single line is pretty hard to understand. Is it possible to print a new line for each '\n' in stdout?

edte commented 2 years ago

same problem

edte commented 2 years ago

I tried modifying the config file without success, but after querying google, I am now temporarily using the awk command to replace \n

like

lc test 1252.cells-with-odd-values-in-a-matrix.cpp | awk '{gsub(/\\n/,"\n")}1'