Author: Tobias Schlitt
Date: 2006-01-23 14:36:53 +0100 (Mon, 23 Jan 2006)
New Revision: 2008

Log:
- Fix pathes and examples.

Added:
   docs/articles/ConsoleTools/introduction/examples/
   docs/articles/ConsoleTools/introduction/examples/autoload.php
   docs/articles/ConsoleTools/introduction/examples/example_01.php
   docs/articles/ConsoleTools/introduction/examples/example_02.php
   docs/articles/ConsoleTools/introduction/examples/example_03.php
   docs/articles/ConsoleTools/introduction/examples/example_04.php
   docs/articles/ConsoleTools/introduction/examples/example_05.php
   docs/articles/ConsoleTools/introduction/examples/example_06.php
   docs/articles/ConsoleTools/introduction/examples/example_07.php
   docs/articles/ConsoleTools/introduction/examples/example_08.php
   docs/articles/ConsoleTools/introduction/examples/example_09.php
   docs/articles/ConsoleTools/introduction/examples/example_10.php
   docs/articles/ConsoleTools/introduction/img/consoletools_example_06.png
   docs/articles/ConsoleTools/introduction/img/consoletools_example_07.png
   docs/articles/ConsoleTools/introduction/img/consoletools_example_08.png
   docs/articles/ConsoleTools/introduction/img/consoletools_example_09.png
   docs/articles/ConsoleTools/introduction/img/consoletools_example_10.png
Removed:
   
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_06.png
   
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_07.png
   
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_08.png
   
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_09.png
   
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_10.png
Modified:
   docs/articles/ConsoleTools/introduction/introduction.txt

Added: docs/articles/ConsoleTools/introduction/examples/autoload.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/autoload.php       
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/autoload.php       
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,17 @@
+<?php
+
+require_once 'Base/trunk/src/base.php';
+
+/**
+ * Autoload ezc classes 
+ * 
+ * @param string $class_name 
+ */
+function __autoload( $class_name )
+{
+    if ( ezcBase::autoload( $class_name ) )
+    {
+        return;
+    }
+}
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/autoload.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_01.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_01.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_01.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,11 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$output = new ezcConsoleOutput();
+
+$output->formats->info->color = 'blue';
+
+$output->outputText( 'Test text in color blue', 'info' );
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_01.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_02.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_02.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_02.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,25 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$output = new ezcConsoleOutput();
+
+$output->formats->info->color = 'blue';
+
+$output->formats->error->color = 'red';
+$output->formats->error->style = array( 'bold' );
+
+$output->formats->fatal->color = 'red';
+$output->formats->fatal->style = array( 'bold', 'underlined' );
+$output->formats->fatal->bgcolor = 'black';
+
+$output->outputText( 'This is some standard text ' );
+$output->outputText( 'including some error', 'error' );
+$output->outputText( ' wrapped in standard text.' );
+$output->outputText( "\n" );
+
+$output->outputLine( 'This is a fatal error message.', 'fatal' );
+
+$output->outputText( 'Test' );
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_02.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_03.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_03.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_03.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,27 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$output = new ezcConsoleOutput();
+
+$output->formats->info->color = 'blue';
+$output->formats->info->style = array( 'bold' );
+
+$output->setOptions( 
+    array( 
+        'autobreak'      => 78,
+        'verbosityLevel' => 3
+    )
+);
+
+$output->outputLine( 'This is a very very long info text. It has so much 
information in '.
+                     'it, that it will definitly not fit into 1 line. 
Therefore, '.
+                     'ezcConsoleOutput will automatically wrap the line for 
us.', 'info' );
+
+$output->outputLine();
+
+$output->outputLine( 'This verbose information will currently not be 
displayed.', 'info', 10 );
+
+$output->outputLine( 'But this verbose information will be displayed.', 
'info', 2 );
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_03.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_04.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_04.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_04.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,32 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$input = new ezcConsoleInput();
+
+$helpOption = $input->registerOption( 
+    new ezcConsoleOption( 
+        'h',
+        'help'
+    )
+);
+
+try
+{
+    $input->process();
+}
+catch ( ezcConsoleOptionException $e )
+{
+    die( $e->getMessage() );
+}
+
+if ( $helpOption->value !== false )
+{
+    echo "Help requested.";
+}
+else
+{
+    echo "No help requested.";
+}
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_04.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_05.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_05.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_05.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,55 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$input = new ezcConsoleInput();
+
+$helpOption = $input->registerOption( new ezcConsoleOption( 'h', 'help' ) );
+
+$inputOption = $input->registerOption( 
+    new ezcConsoleOption( 
+        'i',
+        'input',
+        ezcConsoleInput::TYPE_STRING
+    )
+);
+
+$outputOption = $input->registerOption(
+    new ezcConsoleOption( 
+        'o',
+        'output'
+    )
+);
+$outputOption->type = ezcConsoleInput::TYPE_STRING;
+
+$inputOption->addDependency( 
+    new ezcConsoleOptionRule( $outputOption )
+);
+$outputOption->addDependency( 
+    new ezcConsoleOptionRule( $inputOption )
+);
+
+try
+{
+    $input->process();
+}
+catch ( ezcConsoleOptionException $e )
+{
+    die( $e->getMessage() );
+}
+
+if ( $helpOption->value === true )
+{
+    echo $input->getSynopsis() . "\n";
+    foreach ( $input->getOptions() as $option )
+    {
+        echo "-{$option->short}/{$option->long}: {$option->shorthelp}\n";
+    }
+}
+elseif ( $outputOption->value !== false )
+{
+    echo "Input: {$inputOption->value}, Output: {$outputOption->value}\n";
+    echo "Arguments: " . implode( ", ", $input->getArguments() ) . "\n";
+}
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_05.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_06.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_06.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_06.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,19 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$output = new ezcConsoleOutput();
+
+$bar = new ezcConsoleProgressbar( $output, 15 );
+
+for ( $i = 0; $i < 15; $i++ )
+{
+    $bar->advance();
+    usleep(  mt_rand( 2000, 200000 ) );
+}
+
+$bar->finish();
+
+$output->outputLine();
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_06.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_07.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_07.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_07.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,29 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$output = new ezcConsoleOutput();
+
+$output->formats->bar->color = 'blue';
+$output->formats->bar->style = array( 'bold' );
+
+$options = array( 
+    'emptyChar'       => ' ',
+    'barChar'         => '-',
+    'formatString'    => '%fraction%% <' . $output->formatText( '%bar%', 'bar' 
) . '> Uploaded %act% / %max% kb',
+    'redrawFrequency' => 50,
+);
+
+$bar = new ezcConsoleProgressbar( $output, 1024, $options );
+
+for ( $i = 0; $i < 1024; $i++ )
+{
+    $bar->advance();
+    usleep(  mt_rand( 200, 2000 ) );
+}
+
+$bar->finish();
+
+$output->outputLine();
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_07.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_08.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_08.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_08.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,27 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$output = new ezcConsoleOutput();
+
+$output->formats->success->color = 'green';
+$output->formats->failure->color = 'red';
+
+$options = array( 
+    'successChar' => $output->formatText( '+', 'success' ),
+    'failureChar' => $output->formatText( '-', 'failure' ),
+);
+
+$status = new ezcConsoleStatusbar( $output, $options );
+
+for ( $i = 0; $i < 120; $i++ )
+{
+    $nextStatus = ( bool )mt_rand( 0,1 );
+    $status->add( $nextStatus );
+    usleep(  mt_rand( 200, 2000 ) );
+}
+
+$output->outputLine();
+$output->outputLine( 'Successes: ' . $status->getSuccessCount() . ', Failures: 
' . $status->getFailureCount() );
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_08.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_09.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_09.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_09.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,43 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$data = array( 
+    array( 'Name', 'Nationality', 'Birthday' ),
+    array( 'Derick Rethans', 'Dutch', '1978-12-22' ),
+    array( 'Frederik Holljen', 'Canadian / Norwegian', '1978-11-15' ),
+    array( 'Jan Borsodi', 'Norwegian', '1977-10-13' ),
+    array( 'Raymond Bosman', 'Dutch', '1979-07-24' ),
+    array( 'Tobias Schlitt', 'German', '1980-05-19' ),
+);
+
+$output = new ezcConsoleOutput();
+
+$output->formats->headBorder->color = 'blue';
+$output->formats->normalBorder->color = 'gray';
+
+$output->formats->headContent->color = 'blue';
+$output->formats->headContent->style = array( 'bold' );
+
+$table = new ezcConsoleTable( $output, 78 );
+
+$table->options->defaultBorderFormat = 'normalBorder';
+
+$table[0]->borderFormat = 'headBorder';
+$table[0]->format = 'headContent';
+$table[0]->align = ezcConsoleTable::ALIGN_CENTER;
+
+foreach ( $data as $row => $cells )
+{
+    foreach ( $cells as $cell )
+    {
+        $table[$row][]->content = $cell;
+    }
+}
+
+$output->outputLine( 'eZ components team:' );
+$table->outputTable();
+$output->outputLine();
+
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_09.php
___________________________________________________________________
Name: svn:eol-style
   + native

Added: docs/articles/ConsoleTools/introduction/examples/example_10.php
===================================================================
--- docs/articles/ConsoleTools/introduction/examples/example_10.php     
2006-01-23 13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/examples/example_10.php     
2006-01-23 13:36:53 UTC (rev 2008)
@@ -0,0 +1,38 @@
+<?php
+
+require_once 'examples/autoload.php';
+
+$output = new ezcConsoleOutput();
+
+$output->formats->blue->color  = 'blue';
+$output->formats->blue->style = array(  'bold' );
+$output->formats->red->color   = 'red';
+$output->formats->red->style = array(  'bold' );
+$output->formats->green->color = 'green';
+$output->formats->green->style = array(  'bold' );
+
+$colors = array( 'red', 'blue', 'green' );
+$aligns = array( ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, 
ezcConsoleTable::ALIGN_RIGHT );
+
+$table = new ezcConsoleTable( $output, 78 );
+
+$table->options->corner = ' ';
+$table->options->lineHorizontal = ' ';
+$table->options->lineVertical = ' ';
+$table->options->widthType = ezcConsoleTable::WIDTH_FIXED;
+
+for ( $i = 0; $i < 10; $i++ )
+{
+    for ( $j = 0; $j < 10; $j++ )
+    {
+        $table[$i][$j]->content = '*';
+        $table[$i][$j]->format  = $colors[array_rand( $colors )];
+        $table[$i][$j]->align   = $aligns[array_rand( $aligns )];
+    }
+}
+
+$table->outputTable();
+$output->outputLine();
+
+
+?>


Property changes on: 
docs/articles/ConsoleTools/introduction/examples/example_10.php
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: docs/articles/ConsoleTools/introduction/img/consoletools_example_06.png 
(from rev 2007, 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_06.png)

Copied: docs/articles/ConsoleTools/introduction/img/consoletools_example_07.png 
(from rev 2007, 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_07.png)

Copied: docs/articles/ConsoleTools/introduction/img/consoletools_example_08.png 
(from rev 2007, 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_08.png)

Copied: docs/articles/ConsoleTools/introduction/img/consoletools_example_09.png 
(from rev 2007, 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_09.png)

Copied: docs/articles/ConsoleTools/introduction/img/consoletools_example_10.png 
(from rev 2007, 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_10.png)

Deleted: 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_06.png
===================================================================
(Binary files differ)

Deleted: 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_07.png
===================================================================
(Binary files differ)

Deleted: 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_08.png
===================================================================
(Binary files differ)

Deleted: 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_09.png
===================================================================
(Binary files differ)

Deleted: 
docs/articles/ConsoleTools/introduction/img/consoletools_tutorial_example_10.png
===================================================================
(Binary files differ)

Modified: docs/articles/ConsoleTools/introduction/introduction.txt
===================================================================
--- docs/articles/ConsoleTools/introduction/introduction.txt    2006-01-23 
13:16:25 UTC (rev 2007)
+++ docs/articles/ConsoleTools/introduction/introduction.txt    2006-01-23 
13:36:53 UTC (rev 2008)
@@ -87,7 +87,7 @@
 As already mentioned, the class ezcConsoleOutput is the tool of choice for
 printing text to the console. Let's look at a basic example:
 
-.. include:: examples/tutorial_example_01.php
+.. include:: examples/example_01.php
    :literal:
 
 As you can see, the ezcConsoleOutput object is simply instantiated. If you
@@ -104,7 +104,7 @@
 As easy as this was, we can define more formats and assign more attributes to
 them, as the next example shows:
 
-.. include:: examples/tutorial_example_02.php
+.. include:: examples/example_02.php
    :literal:
 
 As seen before, we start with the simple "info" format. After that, we create
@@ -130,7 +130,7 @@
 
 Two things are left to show for ezcConsoleOutput:
 
-.. include:: examples/tutorial_example_03.php
+.. include:: examples/example_03.php
    :literal:
 
 Again we define a format for later use. After that, we now set some options
@@ -165,7 +165,7 @@
 we can request it from him. This can be done using the class ezcConsoleInput.
 Let's start again by looking at an example.
 
-.. include:: examples/tutorial_example_04.php
+.. include:: examples/example_04.php
    :literal:
    
 First we create a simple instance of ezcConsoleInput. After that (line 7), we
@@ -197,7 +197,7 @@
 This was a very basic example, so let's dig into some more advanced things, 
 ezcConsoleInput can do for you:
 
-.. include:: examples/tutorial_example_05.php
+.. include:: examples/example_05.php
    :literal:
 
 Again we register the -h/--help option as you've seen in the previous example.
@@ -240,7 +240,7 @@
 much more information. If you request help, the synopsis printed may for 
 example look like this: ::
 
-  $ ./examples/tutorial_example_05.php [-h] [-i <string> [-o <string>] ]  
[[--] <args>] 
+  $ ./examples/example_05.php [-h] [-i <string> [-o <string>] ]  [[--] <args>] 
 
 As you can see, all options we defined are available, the types of values are
 indicated and even the dependencies are reflected. Beside that, we have an
@@ -266,7 +266,7 @@
 
 To make this more clear, here is an example call, including it's output: ::
 
-  $ ./examples/tutorial_example_05.php -i /var/www -o /tmp foo bar 
+  $ ./examples/example_05.php -i /var/www -o /tmp foo bar 
 
 For this input the program will print: ::
 
@@ -287,7 +287,7 @@
 Next, let's take a look on indicating progress to the user, by providing a
 progressbar:
 
-.. include:: examples/tutorial_example_06.php
+.. include:: examples/example_06.php
    :literal:
 
 In the example we first create an output handler to print text on the console.
@@ -302,7 +302,7 @@
 This is basically all you have to do, to create a basic progressbar, which 
will 
 look like this after we called advance() for a couple of times:
 
-.. image:: img/consoletools_tutorial_example_06.png
+.. image:: img/consoletools_example_06.php
 
 The bar will constantly move forward, every time you call advance() and
 reach it's end (and the 100% value) when you call advance() for the 15th time.
@@ -315,7 +315,7 @@
 needs. This can be done easily with ezcConsoleProgressbar, too. Take a look at
 the following advanced example:
 
-.. include:: examples/tutorial_example_07.php
+.. include:: examples/example_07.php
    :literal:
 
 This time, we define a format to be applied to the bar itself and call it
@@ -329,7 +329,7 @@
 into which the progressbar is rendered later. To make that a bit more clear,
 see here, how the progressbar will look like, when you render it: 
 
-.. image:: img/consoletools_tutorial_example_07.png
+.. image:: img/consoletools_example_07.php
 
 As you can see, we have the fraction value displayed at the beginning this
 time, followed by the progressbar itself (which looks quite different to the
@@ -360,7 +360,7 @@
 So, let's take a short look at the little brother of ezcConsoleProgressbar, the
 ezcConsoleStatusbar:
 
-.. include:: examples/tutorial_example_08.php
+.. include:: examples/example_08.php
    :literal:
 
 As usual, we define some output formats, this time one called "success" and the
@@ -381,7 +381,7 @@
 ezcConsoleStatusbar::getFailureCount() to display them to the user. Take a
 look at the result here:
 
-.. image:: img/consoletools_tutorial_example_08.png
+.. image:: img/consoletools_example_08.php
 
 If you want to know more about indicating progress to the user from your shell
 application, take a look at the API documentation of ezcConsoleProgressbar_ and
@@ -401,12 +401,12 @@
 at some example code, let me first show you, how the table will look like,
 that we want to create:
 
-.. image:: img/consoletools_tutorial_example_09.png
+.. image:: img/consoletools_example_09.php
 
 As you can see, a table with a nice headline is created. Now, guess how much
 code you need for just generating such a table? No idea? So, here we go:
 
-.. include:: examples/tutorial_example_09.php
+.. include:: examples/example_09.php
    :literal:
 
 Also this example looks quite long, you will see that it is not the generation
@@ -458,7 +458,7 @@
 
 Let's see, if we can also produce something funny with ezcConsoleTable:
 
-.. include:: examples/tutorial_example_10.php
+.. include:: examples/example_10.php
    :literal:
 
 As you already might have guessed, the code does not really make much sense in
@@ -489,7 +489,7 @@
 cell, so it is individual for each cell) are set randomly, so we will get a
 very colorful picture from it. Let's take a look at this:
 
-.. image:: img/consoletools_tutorial_example_10.png
+.. image:: img/consoletools_example_10.php
 
 Funny and senseless, but I hope you got to know the concept behind
 ezcConsoleTable a bit better.

-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to