From cd8010e938a2d82cc838bf0e1af8a2ab4e21aedb Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 28 Jul 2010 12:42:38 -0300 Subject: Adding mySfTask --- lib/task/mySfTask.class.php | 58 +++++++++++++++++++++++++++++++++++++++++++++ package.xml | 1 + 2 files changed, 59 insertions(+) create mode 100644 lib/task/mySfTask.class.php diff --git a/lib/task/mySfTask.class.php b/lib/task/mySfTask.class.php new file mode 100644 index 0000000..15d4502 --- /dev/null +++ b/lib/task/mySfTask.class.php @@ -0,0 +1,58 @@ +commandApplication) || !$this->commandApplication->isVerbose()) + { + return; + } + + $perc = ($current/$total)*100; + + // Show activity by cycling through the array of indicators on each iteration + $this->counter += $this->counter === count($this->indicators) ? -3 : 1; + $indicator = $this->indicators[$this->counter - 1]; + + // if it's not first iteration, remove the previous bar by outputting a + // backspace characters + if($current > 0) echo str_repeat("\x08", $size); + + // generate progess bar + $progress = floor($current / $total * ($size - 11)); + $soFar = str_repeat('=', $progress); + $remaining = str_repeat(' ', $size - 11 - $progress); + + // prefix the bar with a (padded) percent progress and activity indicator + // and wrap it in square brackets, with a greater-than as the current + // position indicator + printf(" %s %3u%% [%s>%s]",$indicator,$perc,$soFar,$remaining); + + // if it's the end, add a new line + if($current == $total) + { + echo "\n"; + } + } +} diff --git a/package.xml b/package.xml index 8e6a11c..794c9c7 100644 --- a/package.xml +++ b/package.xml @@ -30,6 +30,7 @@ + -- cgit v1.2.3