lucee.Componentcommandbox.system.modules_app.system-commands.commands.recipe
The recipe commands allows you to execute a collection of CommandBox commands usually in a file.boxr recipe file. CommandBox will iterate and execute each of the commands for you in succession. Lines that start with a # followed by whitespace will be ignored as comments. . {code:bash} recipe myRecipe.boxr {code} . You can also bind the recipe with arguments that will be replaced inside of your recipe. Pass any arguments as additional parameters to the recipe command. Named arguments will be accessable inside the recipe as system settings ${arg1Name}, ${arg2Name}, etc. Positional args will be avaialble as ${1}, ${2}, etc. . Recipe will receive ${name} and ${action} {code:bash} recipe recipeFile=buildSite.boxr name=luis action=create {code} . Recipe will receive ${1} and ${2} {code:bash} recipe buildSite.boxr luis create {code} . System settings which are not found, are replaced with a space. Remember, you can default then as ${name:default} . You can use "echo on" and "echo off" in recipes to control whether the commands output to the console as they are executed. This can be useful for debugging or confirming the success of commands with no output. Echo is on by default. Note, "echo off" doesn't suppress the output of the commands, just the printing of the command and its arguments prior to execution. This does not use the actual "echo" command and is a feature that only applies during the execution of recipes. {code:bash} echo on # Now you see me echo off # Now you don't {code} If you have one or more commands to execute which are not contained in a file, but are in a variable or being output from another command, you can simply pass the commands in directly. The your input does not match a file on the file system, the recipe command will attempt to execute your input directly as commands {code:bash} set cmd="package show" recipe ${cmd} env show cmd | recipe {code}
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
parser
|
true
|
false
|
Method Summary | |
---|---|
private string
|
bindArgs(any commands, struct args)
Bind arguments to commands. |
private struct
|
parseArguments(any args)
Parse arguments and return a collection. |
any
|
run(any recipeFile)
|
Methods inherited from class lucee.Component |
---|
None |
Property Detail |
---|
access
- publicrequired
- falsereturntype
- anyinject
- Parserserializable
- trueMethod Detail |
---|
Bind arguments to commands
commands
args
Parse arguments and return a collection
args
recipeFile
- The name of the recipe file to execute including extension. Alternatively, text comamnds to direct execute.