Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Latest commit 991c993 Dec 17, 2020 History
This is the initial commit
1 contributor

Users who have contributed to this file

#!/usr/bin/bash
# By O. Echevarria
# orlando.echevarria@uconn.edu
# School of Engineering
# GPL
welcomeMsg(){
echo "Welcome, you are about to create an empty WordPress Plugin Template"
echo ""
}
askPluginName(){
read -p "Enter the name of the plugin you want to create in lowercase (e.g., myfoo-plugin) ==> " plugname
if test ! -d $plugname; then
# create PLUGINNAME directory
mkdir $plugname
if test -d $plugname; then
echo "Directory $plugname created"
else
echo "Error: Directory $plugname not created"
fi
# create PLUGINNAME.php file
filedat=$plugname/$plugname.php
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create uninstall.php file
filedat=$plugname/uninstall.php
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create index.php file
filedat=$plugname/index.php
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create languages/ directory
filedat=$plugname/languages
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
else
echo "Error: Directory $filedat not created"
fi
# create languages/index.php file
filedat=$plugname/languages/index.php
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create includes/ directory
filedat=$plugname/includes
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
else
echo "Error: Directory $filedat not created"
fi
# create includes/index.php file
filedat=$plugname/includes/index.php
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create admin/ directory
filedat=$plugname/admin
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
else
echo "Error: Directory $filedat not created"
fi
# create admin/admin-PLUGINNAME.php file
filedat=$plugname/admin/admin-$plugname.php
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create admin/index.php file
filedat=$plugname/admin/index.php
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create admin/js
filedat=$plugname/admin/js
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
else
echo "Error: Directory $filedat not created"
fi
# create admin/js/admin-PLUGINNAME.js
filedat=$plugname/admin/js/admin-$plugname.js
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create admin/css/ directory
filedat=$plugname/admin/css
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
else
echo "Error: Directory $filedat not created"
fi
# create admin/css/admin-PLUGINNAME.css
filedat=$plugname/admin/css/admin-$plugname.css
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create admin/images/ directory
filedat=$plugname/admin/images
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
else
echo "Error: Directory $filedat not created"
fi
# create public directory
filedat=$plugname/public
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
else
echo "Error: Directory $filedat not created"
fi
# create public/index.php file
filedat=$plugname/public/index.php
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create public/public-PLUGINNAME.php file
filedat=$plugname/public/public-$plugname.php
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create public/js directory
filedat=$plugname/public/js
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
else
echo "Error: Directory $filedat not created"
fi
# create public/js/public-PLUGINNAME.js file
filedat=$plugname/public/js/public-$plugname.js
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create public/css/ directory
filedat=$plugname/public/css
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
fi
# create public/css/public-PLUGINNAME.css file
filedat=$plugname/public/css/public-$plugname.css
touch $filedat
if test -f $filedat; then
echo "File $filedat created"
else
echo "Error: File $filedat not created"
fi
# create public/images directory
filedat=$plugname/public/images
mkdir $filedat
if test -d $filedat; then
echo "Directory $filedat created"
fi
else
echo "Directory $plugname aleady exists!"
echo "Directory $plugname creation command not executed."
fi
}
welcomeMsg
askPluginName