#!/bin/bash # Script to easily create a new command, including: # - a template for the main command file # - test folder and test head.js file # - a template for a first test # - all necessary build manifests if [[ -z $1 || -z $2 ]]; then echo "$0 expects two arguments:" echo "$(basename $0) command-file-name CommandName" echo " 1) The file name for the command, with '-' as separators between words" echo " This will be the name of the folder" echo " 2) The command name being caml cased" echo " This will be used to craft the name of the JavaScript class" exit fi if [ -e $1 ]; then echo "$1 already exists. Please use a new folder/command name." fi CMD_FOLDER=$1 CMD_FILE_NAME=$1-command.js CMD_NAME=$2Command pushd `dirname $0` echo "Creating a new command called '$CMD_NAME' in $CMD_FOLDER" mkdir $CMD_FOLDER cat > $CMD_FOLDER/moz.build < $CMD_FOLDER/$CMD_FILE_NAME < $CMD_FOLDER/tests/browser.toml < $CMD_FOLDER/tests/head.js < $CMD_FOLDER/tests/browser_$1.js <