Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We have our first task written, and we know how to execute it, but what if we want to pass some arguments into it? For example, what if we want our greet task to accept an option so we can customize who we greet? Let’s look at how Cake lets us do that.
The first step in being able to pass options to our tasks is to define the option. We do this using the special option function that Cake gives us. This function takes three arguments. The first argument is the “short” form of the option, the second argument is the “long” form of the option, and the final argument is a simple description of what the option does. Let’s take a look at our greet task again, and this time let’s define an option so we can customize the greeting.