# 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
echo"Creating a new command called '$CMD_NAME' in $CMD_FOLDER"
mkdir $CMD_FOLDER
cat > $CMD_FOLDER/moz.build <<EOF # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules( "$CMD_FILE_NAME",
)
if CONFIG["MOZ_BUILD_APP"] != "mobile/android":
BROWSER_CHROME_MANIFESTS += ["tests/browser.toml"]
EOF
cat > $CMD_FOLDER/$CMD_FILE_NAME <<EOF
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
cat > $CMD_FOLDER/tests/head.js <<EOF
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
echo"" echo"Command created!" echo"" echo"Now:" echo" - edit moz.build to add '\"$CMD_FOLDER\",' in DIRS (this need to be kept sorted)" echo" - edit index.js to add '$CMD_NAME_FIRST_LOWERCASE: \"devtools/shared/commands/$CMD_FOLDER/$1-command\"' in Commands dictionary"
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.