pythonopenai-apichatgpt-api

Remove leading space from Shell GPT code output?


I'm using Shell GPT to send queries to GPT from Linux terminal. One problem - it prints a space before each line of code it gives, for example:

 #!/bin/bash

 # Get the current date and time
 current_date_time=$(date '+%Y-%m-%d %H:%M:%S')
       

This leading space is very annoying when copypasting the code.

What needs to be modified in the Shell GPT source code to fix this?


Solution

  • Loacte site-packages/rich/markdown.py

    In the method __rich_console__ of the class CodeBlock :

    code, self.lexer_name, theme=self.theme, word_wrap=True, padding=1
    

    Change padding=1 to padding=0