paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 91420c3544b8e275a2f83dd782e83fdaa82170d9
parent 6793b3e75f7795e51a2cfca71a6a28d602b24377
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Thu, 28 Mar 2019 00:47:01 -0400

Add help option to createpages.sh

Now, someone can pass -h or --help as the *first* argument to
createpages.sh to get a brief helptext on using the script. It uses the
first argument only for this to avoid unnecessarily complicated argument
parsing for such a small script.

Diffstat:
Mcreatepages.sh | 30++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/createpages.sh b/createpages.sh @@ -14,6 +14,27 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. +if [[ $1 == '-h' || $1 == '--help' ]]; then + echo -e "Usage: createpages.sh [-hc] [<pages_to_compile>]\n" + echo -e "Options:" + echo -e " -h | --help – View this help screen" + echo -e " -c | --css – Minify CSS and exit" + echo -e "\nExamples:" + echo -e " createpages.sh -c" + echo -e " createpages.sh pages/**" + echo -e " createpages.sh pages/guides/new-guide.md pages/guides.md" + exit 0 +fi + +if [[ $1 == '-c' || $1 == '--css' ]]; then + echo "Minifying CSS..." + curl --data "input=`cat build/base.css`" https://cssminifier.com/raw > \ + public/css/base.min.css + curl --data "input=`cat build/roll.css`" https://cssminifier.com/raw > \ + public/css/roll.min.css + exit 0 +fi + htmldir="public/html" echo "Building $@..." @@ -54,11 +75,4 @@ for page in $@; do echo -e "=====Created $htmldir/$savepath/$pagename.html=====\n" fi done - -if [[ $1 == '-i' ]]; then - echo "Minifying CSS..." - curl --data "input=`cat build/base.css`" https://cssminifier.com/raw > \ - public/css/base.min.css - curl --data "input=`cat build/roll.css`" https://cssminifier.com/raw > \ - public/css/roll.min.css -fi +exit 0