File: doc/

Recommend this page to a friend!
  Classes of Alexandre  >  PHP Commands  >  doc/  >  Download  
File: doc/
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PHP Commands
Run commands for CLI programs using class packages
Author: By
Last change:
Date: 2 years ago
Size: 1,883 bytes


Class file image Download

Section tool


Creating a simple section

The section is used to update or move content at a predefined position on the screen. You can create a section with the section method and place it where you decide with the placeHere method. Every content in the section will written at the placed position. Here is an example to illustrate this :

// In the "handle" method of your command class ...
$this->writeLn('This goes before');
$section = $this->section()->placeHere();
$this->writeLn('This goes after');

$section->writeLn('This goes in the <cs color="blue">middle</cs>');
$section->overwriteLn('This goes in the <cs color="red">middle</cs>');

command section

Moving a section

Sections can also be easily moved around with the placeHere method. Try this for example :

// In the "handle" method of your command class ...
$this->writeLn('This goes before');
$section = $this->section()
    ->writeLn('This is a moving section');
$this->writeLn('This goes after');


command moving section

> {.info} The section tool is used by other tools for their "sticky" display. For example you can use $this->bloc()->placeHere() to display a bloc content at the same place on the screen all the time. You might also the section tool to build your own command tool.


A section can message be displayed or not depending on the verbosity.

// In the "handle" method of your command class ...
$section = $this->section()->placeHere();
$section->writeLn('This message is quiet', self::VERBOSITY_QUIET);
$section->writeLn('This message is standard');
$section->writeLn('This message is verbose', self::VERBOSITY_VERBOSE);
$section->writeLn('This message is debug', self::VERBOSITY_DEBUG);
For more information send a message to info at phpclasses dot org.