Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Docs Cli Command

Frank Kleine edited this page Apr 7, 2012 · 1 revision

The stubConsoleCommand interface

For creating command line scripts one should create classes implementing the net::stubbles::console::stubConsoleCommand interface. This interface has only one method: run() in which all the action takes place.

Why creating a class and implementing a special interface?

While it does not seem reasonable to create a whole class just for the script and even implement a special interface there are some good reasons to do so:

  1. With a class one can implement a __bindings() method and use the Dependency Injection feature for command line scripts.
  2. Following the dependency injection way you should get a testable class - this allows you to write unit tests for your command line script.
  3. Every implementation of the interface can be run via stubcli command line script - no need to create your own script file for this with the tedious recurring bootstrap code.
Clone this wiki locally