Created
August 23, 2023 02:29
-
-
Save DanKaplanSES/e25ba527d894e00ef719391fa6c99722 to your computer and use it in GitHub Desktop.
A script to convert your current project into a stack overflow post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/bash | |
set -e | |
TREE_IGNORE_PATTERN='node_modules|tscbuild|package-lock.json|.gitignore|.git' | |
echo '### Project Structure' | |
echo '```' | |
tree --noreport -F -a -I $TREE_IGNORE_PATTERN | tr -d '*' | |
echo '```' | |
echo "" | |
PROJECT_FILES=$(mktemp) | |
tree --noreport -nFif -I $TREE_IGNORE_PATTERN | awk '$0 !~ /\/$/ && $0 !~ /^\.$/' | tr -d '*' | awk '{print "" ; print "### " $0 ; print "```" ; system("cat " $0 ) ; print "" ; print "```" ; print "" }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was wasting a lot of time and manual effort copying my project files between Visual Studio Code and stackoverflow, so this bash script prints everything in one step.