I just started working on a small hobby project where the goal is to create a terminal prompt for my self. The prompt is configurable using a JSON file, since I know essentially nothing about bash and .bashrc. When I run my program in the terminal, it looks ok, the colors are working:
The first row is my current prompt, so ignore the first row. The second row shows the output of my program right now, and please ignore the fact that it is ugly as hell, and the colors are all over the place, that is not the problem. I am currently testing a lot of things, and are just picking the first color that comes to mind in my JSON file.
The problem is when I in my .bashrc write:
PS1="\$(/home/per/code/go-prompt/build/go_prompt)"
then the prompt has lost all of it’s color:
This is probably a bash problem, and not a Go problem, so this might not be the best forum for a question like this, but I am trying here first. Does anyone know why the colors disappear? Do I need to add a special character, or two, to initiate coloring (for the terminal to understand colors) in my Go program, or do I need to add something to my .bashrc, or is it impossible to create a terminal prompt using another language (other than bash)?
If it matters, I am testing this on a machine running Linux Mint 20.2, and I am using Go 1.17.
The (incomplete) code can be found here : GitHub - Hultan/goprompt: A terminal prompt configurable using a JSON file