Chapter 7. Accepting user input

 

This chapter covers

  • Interacting with the build user
  • Customizing automation for development
  • Autocompleting parser combinators

In the previous chapters, we focused on how to use sbt to automate the development tasks for the preowned-kittens project. Although this is vitally important, sometimes automation can cause friction in development. For example, if the developers create a ton of slow-running unit tests, it can hurt developer productivity. sbt counters this lost productivity through customized automation, like the testOnly task.

As you may recall from chapter 4, the testOnly task takes user input and declares a filter for which unit tests to run. sbt provides a generalized mechanism for users to customize automation via input tasks.

In sbt, an input task is any task that can accept additional user input before execution. This input is limited to what a user can type in the console or pass in via the command line. But the interaction between the user and the build tool can be highly customized, as you’ll see in this chapter. In particular, input tasks can provide context-sensitive help via tab completion to users of the build console.

7.1. Accepting user input with input tasks

7.2. Defining an interface with parsers

7.3. Defining a database evolution parser

7.4. Helping the user with autocomplete

7.5. Summary