Last active
March 2, 2016 20:33
-
-
Save slugbyte/ccd1653c9ed7a16fa511 to your computer and use it in GitHub Desktop.
This file contains 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/env zsh | |
# This file will recursivly walk though a directory and | |
# create a nice looking README.md of all the source code. | |
# Usage $ markdownify <Output File Name> | |
# | |
# Installation: | |
# copy this code into a file called markdownify | |
# move markdownify into one of your directorys in $PATH | |
# chmod 755 /path/to/markdownify | |
[ $# -eq 0 ] && { | |
echo "USAGE ERROR: try markdownify <Output File Name>" | |
exit 1 | |
} | |
mardownFilePath=$1 | |
printToReadme(){ | |
echo "$1" >> "$mardownFilePath" | |
} | |
catToReadme(){ | |
cat "$1" >> "$mardownFilePath" | |
} | |
for filename in `ls -R -d -1 **/*`;do | |
if [ ! "$filename" = "$1" ]; then | |
if [ -d "$filename" ];then | |
printToReadme "## $filename" | |
fi | |
if [ -f "$filename" ];then | |
printToReadme "**$filename**" | |
printToReadme "\`\`\` javascript" | |
catToReadme "$filename" | |
printToReadme "\`\`\`" | |
printToReadme | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment