I need the output of the command below, ie "* master\n remotes/origin/HEAD -> origin/master\n remotes/origin/master\n"
to be output for reading.
iex(26)> System.cmd "git", ["-C", "/home/vonhabsi/workpad/Cuis/.git","branch","-a"]
{"* master\n remotes/origin/HEAD -> origin/master\n remotes/origin/master\n",
0}
ie in the form
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
This System.cmd
docs adds into: IO.stream(:stdio, :line)
to the command
iex(27)> System.cmd "git", ["-C", "/home/vonhabsi/workpad/Cuis/.git","branch","-a"], into: IO.stream(:stdio, :line)
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
{%IO.Stream{device: :standard_io, line_or_bytes: :line, raw: false}, 0}
iex(28)>
What function do I need to take the "* master\n remotes/origin/HEAD -> origin/master\n remotes/origin/master\n"
from the tuple and output it as:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
The additional output {%IO.Stream{device: :standard_io, line_or_bytes: :line, raw: false}, 0}
is unwanted.
In short how do you take a piece of raw text with \n
newlines and output it as it should be printed.
How do you also save it to a file?