nlopess         Sun May 15 14:34:34 2005 EDT

  Modified files:              
    /phpdoc/en/features commandline.xml 
  Log:
  reorder opts according to 'php -h'. add -B, -R, -F and -E. More to come later 
(docs for -a, for example..)
  
http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.38&r2=1.39&ty=u
Index: phpdoc/en/features/commandline.xml
diff -u phpdoc/en/features/commandline.xml:1.38 
phpdoc/en/features/commandline.xml:1.39
--- phpdoc/en/features/commandline.xml:1.38     Thu Oct 28 05:29:33 2004
+++ phpdoc/en/features/commandline.xml  Sun May 15 14:34:33 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.38 $ -->
+<!-- $Revision: 1.39 $ -->
 <chapter id="features.commandline">
  <title>Using PHP from the command line</title>
  <!-- NEW DOCUMENTATION STARTS -->
@@ -356,25 +356,34 @@
   <option>-h</option> switch:
   <screen>
 <![CDATA[
-Usage: php [options] [-f] <file> [args...]
-       php [options] -r <code> [args...]
-       php [options] [-- args...]
-  -s               Display colour syntax highlighted source.
-  -w               Display source with stripped comments and whitespace.
-  -f <file>        Parse <file>.
-  -v               Version number
-  -c <path>|<file> Look for php.ini file in this directory
+Usage: php [options] [-f] <file> [--] [args...]
+       php [options] -r <code> [--] [args...]
+       php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
+       php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
+       php [options] -- [args...]
+
   -a               Run interactively
+  -c <path>|<file> Look for php.ini file in this directory
+  -n               No php.ini file will be used
   -d foo[=bar]     Define INI entry foo with value 'bar'
   -e               Generate extended information for debugger/profiler
-  -z <file>        Load Zend extension <file>.
+  -f <file>        Parse <file>.
+  -h               This help
+  -i               PHP information
   -l               Syntax check only (lint)
   -m               Show compiled in modules
-  -i               PHP information
   -r <code>        Run PHP <code> without using script tags <?..?>
-  -h               This help
+  -B <begin_code>  Run PHP <begin_code> before processing input lines
+  -R <code>        Run PHP <code> for every input line
+  -F <file>        Parse and execute <file> for every input line
+  -E <end_code>    Run PHP <end_code> after processing all input lines
+  -H               Hide any passed arguments from external tools.
+  -s               Display colour syntax highlighted source.
+  -v               Version number
+  -w               Display source with stripped comments and whitespace.
+  -z <file>        Load Zend extension <file>.
 
-  args...          Arguments passed to script. Use -- args when first argument 
+  args...          Arguments passed to script. Use -- args when first argument
                    starts with - or script is read from stdin
 ]]>
   </screen>
@@ -538,75 +547,11 @@
     </thead>
     <tbody>
      <row>
-      <entry>-s</entry>
-      <entry>--syntax-highlight</entry>
-      <entry>
-       <para>
-        Display colour syntax highlighted source.
-       </para>
-       <para>
-        This option uses the internal mechanism to parse the file and produces
-        a <literal>HTML</literal> highlighted version of it and writes it to
-        standard output. Note that all it does it to generate a block of
-        <literal>&lt;code&gt; [...] &lt;/code&gt;</literal>
-        <literal>HTML</literal> tags, no <literal>HTML</literal> headers.
-       </para>
-       <note>
-        <para>
-         This option does not work together with the <option>-r</option>
-         option.
-        </para>
-       </note>
-      </entry>
-     </row>
-     <row>
-      <entry>-s</entry>
-      <entry>--syntax-highlighting</entry>
-      <entry>
-       <para>
-        Alias of <option>--syntax-highlight</option>.
-       </para>
-      </entry>
-     </row>
-     <row>
-      <entry>-w</entry>
-      <entry>--strip</entry>
-      <entry>
-       <para>
-        Display source with stripped comments and whitespace.
-       </para>
-       <note>
-        <para>
-         This option does not work together with the <option>-r</option>
-         option.
-        </para>
-       </note>
-      </entry>
-     </row>
-     <row>
-      <entry>-f</entry>
-      <entry>--file</entry>
-      <entry>
-       <para>
-        Parses and executed the given filename to the <option>-f</option>
-        option. This switch is optional and can be left out. Only providing
-        the filename to execute is sufficient.
-       </para>
-      </entry>
-     </row>
-     <row>
-      <entry>-v</entry>
-      <entry>--version</entry>
+      <entry>-a</entry>
+      <entry>--interactive</entry>
       <entry>
        <para>
-        Writes the PHP, PHP SAPI, and Zend version to standard output, e.g.
-        <screen>
-<![CDATA[
-$ php -v
-PHP 4.3.0 (cli), Copyright (c) 1997-2002 The PHP Group
-Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
-]]>
-        </screen>
+        Runs PHP interactively.
        </para>
       </entry>
      </row>
@@ -680,44 +625,44 @@
       </entry>
      </row>
      <row>
-      <entry>-a</entry>
-      <entry>--interactive</entry>
+      <entry>-e</entry>
+      <entry>--profile-info</entry>
       <entry>
        <para>
-        Runs PHP interactively.
-        <!-- 
-        mfischer, 20020510: Couldn't come up with a decent useful description
-        of the current implementation of the interactive mode.
-        -->
+        Activate the extended information mode, to be used by a
+        debugger/profiler.
        </para>
       </entry>
      </row>
      <row>
-      <entry>-e</entry>
-      <entry>--profile-info</entry>
+      <entry>-f</entry>
+      <entry>--file</entry>
       <entry>
        <para>
-        Generate extended information for debugger/profiler.
-        <!-- 
-        mfischer, 20020510: Anyone who can provide more information what it
-        really does (even if it's only for developers) ?
-        -->
+        Parses and executed the given filename to the <option>-f</option>
+        option. This switch is optional and can be left out. Only providing
+        the filename to execute is sufficient.
        </para>
       </entry>
      </row>
      <row>
-      <entry>-z</entry>
-      <entry>--zend-extension</entry>
+      <entry>-h and -?</entry>
+      <entry>--help and --usage</entry>
       <entry>
-       <para>
-        Load Zend extension. If only a filename is given, PHP tries to load
-        this extension from the current default library path on your system
-        (usually specified <filename>/etc/ld.so.conf</filename> on Linux
-        systems).  Passing a filename with an absolute path information will
-        not use the systems library search path. A relative filename with a
-        directory information will tell PHP only to try to
-        load the extension relative to the current directory.
-       </para>
+       With this option, you can get information about the actual list of
+       command line options and some one line descriptions about what they do.
+      </entry>
+     </row>
+     <row>
+      <entry>-i</entry>
+      <entry>--info</entry>
+      <entry>
+       This command line option calls <function>phpinfo</function>, and prints
+       out the results. If PHP is not working correctly, it is
+       advisable to use <command>php -i</command> and see whether any error
+       messages are printed out before or in place of the information tables.
+       Beware that when using the CGI mode the output is in 
<literal>HTML</literal> 
+       and therefore quite huge.
       </entry>
      </row>
      <row>
@@ -775,18 +720,6 @@
       </entry>
      </row>
      <row>
-      <entry>-i</entry>
-      <entry>--info</entry>
-      <entry>
-       This command line option calls <function>phpinfo</function>, and prints
-       out the results. If PHP is not working correctly, it is
-       advisable to use <command>php -i</command> and see whether any error
-       messages are printed out before or in place of the information tables.
-       Beware that when using the CGI mode the output is in 
<literal>HTML</literal> 
-       and therefore quite huge.
-      </entry>
-     </row>
-     <row>
       <entry>-r</entry>
       <entry>--run</entry>
       <entry>
@@ -842,12 +775,10 @@
          </screen>
          If you are using a shell different from sh/bash, you might experience
          further issues. Feel free to open a bug report at
-         <ulink url="&url.php.bugs;">&url.php.bugs;</ulink> or send a mail to
-         &email.php.doc;.
-
+         <ulink url="&url.php.bugs;">&url.php.bugs;</ulink>.
          One can still easily run into troubles when trying to get shell
          variables into the code or using backslashes for escaping. You've
-         been warned. <!-- :-) -->
+         been warned.
         </para>
        </note>
        <note>
@@ -859,30 +790,127 @@
       </entry>
      </row>
      <row>
-      <entry>-h</entry>
-      <entry>--help</entry>
+      <entry>-B</entry>
+      <entry>--process-begin</entry>
       <entry>
-       With this option, you can get information about the actual list of
-       command line options and some one line descriptions about what they do.
+       <para>
+        PHP code to execute before processing stdin. Added in PHP 5.
+       </para>
+      </entry>
+     </row>
+     <row>
+      <entry>-R</entry>
+      <entry>--process-code</entry>
+      <entry>
+       <para>
+        PHP code to execute for every input line. Added in PHP 5.
+       </para>
+       <para>
+        There are two special variables available in this mode:
+        <varname>$argn</varname> and <varname>$argi</varname>.
+        <varname>$argn</varname> will contain the line PHP is processing at
+        that moment, while <varname>$argi</varname> will contain the line
+        number.
+       </para>
+      </entry>
+     </row>
+     <row>
+      <entry>-F</entry>
+      <entry>--process-file</entry>
+      <entry>
+       <para>
+        PHP file to execute for every input line. Added in PHP 5.
+       </para>
+      </entry>
+     </row>
+     <row>
+      <entry>-E</entry>
+      <entry>--process-end</entry>
+      <entry>
+       <para>
+        PHP code to execute after processing the input. Added in PHP 5.
+       </para>
+       <para>
+        Example of using <option>-B</option>, <option>-R</option> and
+        <option>-E</option> options to count the number of lines of a
+        project.
+        <screen>
+<![CDATA[
+$ find my_proj | php -B '$l=0;' -R '$l += count(@file($argn));' -E 'echo 
"Total Lines: $l\n";'
+Total Lines: 37328
+]]>
+        </screen>
+       </para>
+      </entry>
+     </row>
+     <row>
+      <entry>-s</entry>
+      <entry>--syntax-highlight and --syntax-highlight</entry>
+      <entry>
+       <para>
+        Display colour syntax highlighted source.
+       </para>
+       <para>
+        This option uses the internal mechanism to parse the file and produces
+        a <literal>HTML</literal> highlighted version of it and writes it to
+        standard output. Note that all it does it to generate a block of
+        <literal>&lt;code&gt; [...] &lt;/code&gt;</literal>
+        <literal>HTML</literal> tags, no <literal>HTML</literal> headers.
+       </para>
+       <note>
+        <para>
+         This option does not work together with the <option>-r</option>
+         option.
+        </para>
+       </note>
       </entry>
      </row>
      <row>
-      <entry>-?</entry>
-      <entry>--usage</entry>
+      <entry>-v</entry>
+      <entry>--version</entry>
       <entry>
-       Alias of <option>--help</option>.
+       <para>
+        Writes the PHP, PHP SAPI, and Zend version to standard output, e.g.
+        <screen>
+<![CDATA[
+$ php -v
+PHP 4.3.0 (cli), Copyright (c) 1997-2002 The PHP Group
+Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
+]]>
+        </screen>
+       </para>
+      </entry>
+     </row>
+     <row>
+      <entry>-w</entry>
+      <entry>--strip</entry>
+      <entry>
+       <para>
+        Display source with stripped comments and whitespace.
+       </para>
+       <note>
+        <para>
+         This option does not work together with the <option>-r</option>
+         option.
+        </para>
+       </note>
+      </entry>
+     </row>
+     <row>
+      <entry>-z</entry>
+      <entry>--zend-extension</entry>
+      <entry>
+       <para>
+        Load Zend extension. If only a filename is given, PHP tries to load
+        this extension from the current default library path on your system
+        (usually specified <filename>/etc/ld.so.conf</filename> on Linux
+        systems).  Passing a filename with an absolute path information will
+        not use the systems library search path. A relative filename with a
+        directory information will tell PHP only to try to
+        load the extension relative to the current directory.
+       </para>
       </entry>
      </row>
-     <!--
-     new, not in PHP 4.3.4, but are in php_cli.c 1.102 or cgi_main.c 1.243
-     -b <address:port>|<port> bindpath Bind Path for external FASTCGI Server 
mode, only CGI, no Windows
-     -B <begin_code>     process-begin Run PHP <begin_code> before processing 
input lines
-     -R <code>           process-code  Run PHP <code> for every input line
-     -F <file>           process-file  Parse and execute <file> for every 
input line
-     -E <end_code>       process-end   Run PHP <end_code> after processing all 
input lines
-     -H                  hide-args     Hide any passed arguments from external 
tools.
-     -g                  global        Define global variables on command line
-     -->
     </tbody>
    </tgroup>
   </table>

Reply via email to