Skip to content

Instantly share code, notes, and snippets.

@J4Numbers
Created November 11, 2016 13:37
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 J4Numbers/2ee59c85645c93a6e46b505386027783 to your computer and use it in GitHub Desktop.
Save J4Numbers/2ee59c85645c93a6e46b505386027783 to your computer and use it in GitHub Desktop.
Typical creation script
#!/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