Skip to content

Instantly share code, notes, and snippets.

@johnnyicarus
Last active January 5, 2017 15:03
Show Gist options
  • Select an option

  • Save johnnyicarus/c2a79cc0bb4d1a96001ada6c872f5aca to your computer and use it in GitHub Desktop.

Select an option

Save johnnyicarus/c2a79cc0bb4d1a96001ada6c872f5aca to your computer and use it in GitHub Desktop.
Create a new roots/trellis and roots/bedrock project in a subfolder named with the -n option; usage: sh trellis_project.sh -n foldername
#!/bin/bash
while getopts ":n:" opt; do
case $opt in
n)
echo "Trellis project will be put into directory: $OPTARG" >&2;
mkdir $OPTARG;
cd $OPTARG;
git clone --depth=1 [email protected]:roots/trellis.git;
rm -rf trellis/.git;
git clone --depth=1 [email protected]:roots/bedrock.git site;
rm -rf site/.git;
git init;
cd trellis;
ansible-galaxy install -r requirements.yml;
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment