Created
November 11, 2016 13:37
-
-
Save J4Numbers/2ee59c85645c93a6e46b505386027783 to your computer and use it in GitHub Desktop.
Typical creation script
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 | |
function toucher() | |
{ | |
echo "Creating file $1.$2 in the $INSTRUCT project..."; | |
touch $MAINPROJ/$SUBPROJ/$3/$1.$2; | |
echo "File has been created."; | |
} | |
function showHelp() | |
{ | |
echo "To use this command, please append any of the following flags:"; | |
echo " -c : Create a new pair of files in the $INSTRUCT project"; | |
echo " -s : Create a new .cpp file in the $INSTRUCT project"; | |
echo " -n : Create a new .hpp file in the $INSTRUCT project"; | |
echo " -h : See this help screen"; | |
} | |
function create() | |
{ | |
if [[ $1 == "-s" ]] || [[ $1 == "-c" ]]; then | |
toucher "$2" "cpp" "src"; | |
valid=1; | |
fi | |
if [[ $1 == "-n" ]] || [[ $1 == "-c" ]]; then | |
toucher "$2" "hpp" "headers"; | |
valid=1; | |
fi | |
if [[ $valid != 1 ]]; then | |
showHelp; | |
fi | |
} | |
MAINPROJ="Networking"; | |
SUBPROJ="Networking"; | |
if [[ $1 == "-h" ]]; then | |
showHelp; | |
else | |
create $1 $2; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment