Last active
May 25, 2016 22:34
-
-
Save stigok/e719a3d818bd4549b36801d4be91aeaf to your computer and use it in GitHub Desktop.
Bash utility to copy a skeleton directory to predefined target path
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
#!/bin/bash | |
# Set $skeleton to desired path and rename the file to e.g. closet.sh | |
# Set $path to desired target directory to raise the skeleton | |
# Usage: closet project-name | |
name=$1 | |
path=~/repos/$name | |
skeleton=~/repos/sshow-node-module-skeleton | |
if [ "$1" == "--current" ]; then | |
printf "Closet at $skeleton" | |
fi | |
if [ ! -d "$skeleton" ]; then | |
printf "Skeleton does not exist at $skeleton" | |
exit 1 | |
fi | |
if [ -d "$path" ]; then | |
echo "Project already exists at $path" | |
readme="$path/README.md" | |
if [ -d "$readme" ]; then | |
head $readme | |
fi | |
exit 1 | |
fi | |
cp -r $skeleton $path | |
echo "Skeleton raised at $path" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
closet --current
print current source directorycloset project-name
raise skeleton at$path/project-name