Add pattern to .gitignore if user confirms, by appending it to the existing content of the file.

# Aider chat conversation:
This commit is contained in:
Paul Gauthier 2023-07-15 13:36:57 -07:00
parent c08527dbbc
commit b0ec8205f3

View file

@ -56,8 +56,10 @@ def check_gitignore(git_root, io):
if not io.confirm_ask(f"Add {pat} to .gitignore (recommended)?"):
return
updated_ignore = content + "\n" + pat + "\n"
gitignore_file.write_text(updated_ignore, encoding="utf-8")
if not content.endswith("\n"):
content += "\n"
content += pat + "\n"
gitignore_file.write_text(content, encoding="utf-8")
def main(args=None, input=None, output=None):