Skip to content

Instantly share code, notes, and snippets.

@stigok
Last active May 25, 2016 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stigok/e719a3d818bd4549b36801d4be91aeaf to your computer and use it in GitHub Desktop.
Save stigok/e719a3d818bd4549b36801d4be91aeaf to your computer and use it in GitHub Desktop.
Bash utility to copy a skeleton directory to predefined target path
#!/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"
@stigok
Copy link
Author

stigok commented May 25, 2016

  • closet --current print current source directory
  • closet project-name raise skeleton at $path/project-name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment