#!/bin/bash # drin - helper tools to initialize Drupal projects # # Copyright (C) 2017 Antonio Ospite # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -e PROGNAME=$(basename "$0") LIBEXEC="@libexec@" usage() { cat <&2 && exit 1; } while [ $# -gt 0 ]; do case "$1" in -h|--help) usage exit 0 ;; -*) echo "Error: Unknown option '${1}'" 1>&2 ;; *) subcommand="${LIBEXEC}/${1}.sh" if [ ! -x "$subcommand" ]; then echo "Error: '${1}' is not a known subcommand." 1>&2 echo "Run '${PROGNAME} --help' for a list of known subcommands." 1>&2 exit 1 else shift exec "$subcommand" "$@" fi ;; esac shift done