repo_prompt_context/naive-prompt.sh
2024-07-28 18:27:22 -07:00

21 lines
812 B
Bash
Executable file

#!/bin/bash
# List all files in the git repository excluding .gitignore and LICENSE files
FILES=$(git ls-files --exclude='\.gitignore' --exclude='LICENSE')
# Print a heading indicating that the following is a list of files and their contents
echo -e "The following is a list of files and their contents. Use these files for context in answering any questions.\n"
# Loop through all the files listed by git ls-files command
for file in $FILES; do
# Print the filename followed by a colon and newline
echo -e "${file}:\n\`\`\`"
# Read the contents of the file, outputting each line prefixed by a tab character
cat $file
# Print an extra newline for separation between files
echo -e "\`\`\`"
done
# Print a footer indicating that the context has ended
echo -e "End Context\n-----------"