Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

7. Cake and Cakefiles > Using Options

Using Options

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.


Tip


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial