How to enable color when using cmd or linux terminal on a file?

292 Views Asked by At

How do I enable color in Julia when I am not using the REPL? When I try and run my Julia script on the Linux terminal it doesn't show colors.

Also another quick question. What's the best way to run a Julia script within another script? Right now, I just do include("file.jl") and add the arguments in the ARGS array.

2

There are 2 best solutions below

0
CVasquezG On BEST ANSWER

Fixed it by putting the following line at the top of my script:

Base.eval(:(have_color = true))
0
Fengyang Wang On

Run your script with

julia --color=yes file.jl

In the future, you should only ask one question per question. But to answer your other question, I would refactor the script into a function and call that function instead. That seems like a more elegant approach than adding arguments to ARGS.