diff options
author | skullY <skullydazed@gmail.com> | 2018-03-23 22:40:12 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-03-25 13:20:30 -0400 |
commit | c4f9b8f297e09c51f9ca751b62de6f5290e244e0 (patch) | |
tree | e187b7edc754f4fa285b15afdd26d6ef3af6b60e /util/new_project.sh | |
parent | e72cad44fa5f695c63373da2cc6fd0e44c361ed8 (diff) |
make new_project.sh work correctly on osx too
Diffstat (limited to 'util/new_project.sh')
-rwxr-xr-x | util/new_project.sh | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/util/new_project.sh b/util/new_project.sh index 11218440ba..0c28feb4ae 100755 --- a/util/new_project.sh +++ b/util/new_project.sh @@ -7,16 +7,23 @@ if [ -z "$1" ]; then exit 1 fi +if [ -e "keyboards/$1" ]; then + echo "Error! keyboards/$1 already exists!" + exit 1 +fi + cd "$(dirname "$0")/.." KEYBOARD=$1 KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}') +KEYBOARD_NAME=$(basename $1) +KEYBOARD_NAME_UPPERCASE=$(echo $KEYBOARD_NAME | awk '{print toupper($0)}') cp -r quantum/template keyboards/$KEYBOARD -mv keyboards/$KEYBOARD/template.c keyboards/$KEYBOARD/$KEYBOARD.c -mv keyboards/$KEYBOARD/template.h keyboards/$KEYBOARD/$KEYBOARD.h -find keyboards/${KEYBOARD} -type f -exec sed -i'' -e "s;%KEYBOARD%;$KEYBOARD;g" {} \; -find keyboards/${KEYBOARD} -type f -exec sed -i'' -e "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" {} \; +mv keyboards/${KEYBOARD}/template.c keyboards/${KEYBOARD}/${KEYBOARD_NAME}.c +mv keyboards/${KEYBOARD}/template.h keyboards/${KEYBOARD}/${KEYBOARD_NAME}.h +find keyboards/${KEYBOARD} -type f -exec sed -i '' -e "s;%KEYBOARD%;${KEYBOARD_NAME};g" {} \; +find keyboards/${KEYBOARD} -type f -exec sed -i '' -e "s;%KEYBOARD_UPPERCASE%;${KEYBOARD_NAME_UPPERCASE};g" {} \; echo "######################################################" echo "# /keyboards/$KEYBOARD project created. To start" |