ClientProgress - progress indicators for Helix Server commands
The ClientProgress
class introduced in 2012.2 provides a
means to report on the progress of running commands; you can customize
this behavior by subclassing ClientUser
and
ClientProgress
.
In ClientUser
, implement ClientUser::CreateProgress()
and ClientUser::ProgressIndicator()
.
In ClientProgress
, implement ClientProgress::Description()
,
ClientProgress::Total()
,
ClientProgress::Update()
,
and ClientProgress::Done()
The methods of your ClientProgress
object will be called
during the life of a server command. Usually, Description()
is called first with a description
and a units
from the server; the units of measure apply to the Total()
and Update()
methods. Total()
is called if
a there is a known upper bound to the number of units, while Update()
is called
from time to time as progress is made. If your Update()
implementation returns non-zero, the API assumes the user has also
attempted to cancel the operation. Done()
is called last,
with the fail
argument being non-zero in case of failure.
When the command is complete, the API destroys the object by calling the
destructor.
Default implementations are used in the p4
command-line client, and report on the progress of p4 -I
submit
and p4 -I sync -q
.