A task target can defined as many method arguments as it wants which can be passed in via command arguments when calling the task.
fun.cfc
There's two ways to pass in the name and verbose parameters: positionally and via named parameters.
If you want to pass your parameters positionally, you must include the task and target name.
A more self-documenting method is to use named parameters. Note, it is not necessary to pass the task and target name when using named parameters, but in this case, my example does not use the default task and target convention names, so I'll need to pass them anyway. Note that we start each parameter name with a colon (:) so they don't interfere with any of the parameters to the actual task run command.
The parameters :name and :verbose will be passed directly along to the task as name and verbose.
Tasks with boolean parameters can also have those passed using flags just like commands. Simply prepend a colon (:) to the name of the flag like so.
Since task run is just a regular command, remember its parameters don't have to be hard coded. They can expressions or system settings, etc.
component{
function greet( string name, boolean verbose ){
print.line( 'Well, hello there #name#!' );
if( verbose ) {
print.line( "You're looking quite well today." );
}
}
}task run fun greet Brad falsetask run taskFile=fun target=greet :name=Brad :verbose=falsetask run --no:verbose
or
task run --!:verbosetask run ${APIDocURL} ${APIDocPort:8080}
task run taskFile=build :message=`cat message.txt`