phing-types
[ class tree: phing-types ] [ index: phing-types ] [ all elements ]

Class: Commandline

Source Location: /types/Commandline.php

Class Overview


Commandline objects help handling command lines specifying processes to execute.


Author(s):

Variables

Constants

Methods



Class Details

[line 46]
Commandline objects help handling command lines specifying processes to execute.

The class can be used to define a command line as nested elements or as a helper to define a command line by an application. <p>

  1.  &lt;someelement&gt;<br>
  2.  &nbsp;&nbsp;&lt;acommandline executable="/executable/to/run"&gt;<br>
  3.  &nbsp;&nbsp;&nbsp;&nbsp;&lt;argument value="argument 1" /&gt;<br>
  4.  &nbsp;&nbsp;&nbsp;&nbsp;&lt;argument line="argument_1 argument_2 argument_3" /&gt;<br>
  5.  &nbsp;&nbsp;&nbsp;&nbsp;&lt;argument value="argument 4" /&gt;<br>
  6.  &nbsp;&nbsp;&lt;/acommandline&gt;<br>
  7.  &lt;/someelement&gt;<br>
The element
  1. someelement
must provide a method
  1. createAcommandline
which returns an instance of this class.




Tags:

author:  thomas.haas@softwired-inc.com
author:  <href="mailto:stefan.bodewig@epost.de" a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>


[ Top ]


Class Variables

$arguments = array()

[line 51]



Tags:

var:  CommandlineArguments[]
access:  public

Type:   array


[ Top ]

$executable =

[line 57]

Full path (if not on %PATH% env var) to executable program.



Tags:

access:  public

Type:   string


[ Top ]



Class Methods


static method quoteArgument [line 160]

static void quoteArgument( $argument)

Put quotes around the given String if necessary.

If the argument doesn't include spaces or quotes, return it as is. If it contains double quotes, use single quotes - else surround the argument by double quotes.




Tags:

exception:  BuildException if the argument contains both, single and double quotes.
access:  public


Parameters:

   $argument  

[ Top ]

static method toString [line 179]

static void toString( $lines)

Quotes the parts of the given array in way that makes them usable as command line arguments.



Tags:

access:  public


Parameters:

   $lines  

[ Top ]

static method translateCommandline [line 201]

static array translateCommandline( string $to_process)



Tags:

access:  public


Parameters:

string   $to_process  

[ Top ]

constructor __construct [line 61]

Commandline __construct( [ $to_process = null])



Tags:

access:  public


Parameters:

   $to_process  

[ Top ]

method addArguments [line 110]

void addArguments( $line)



Tags:

access:  public


Parameters:

   $line  

[ Top ]

method clear [line 283]

void clear( )

Clear out the whole command line.



Tags:

access:  public


[ Top ]

method clearArgs [line 292]

void clearArgs( )

Clear out the arguments but leave the executable in place for another operation.



Tags:

access:  public


[ Top ]

method createArgument [line 84]

CommandlineArgument createArgument( [boolean $insertAtStart = false])

Creates an argument object and adds it to our list of args.

Each commandline object has at most one instance of the argument class.




Tags:

access:  public


Parameters:

boolean   $insertAtStart   if true, the argument is inserted at the beginning of the list of args, otherwise it is appended.

[ Top ]

method createMarker [line 304]

CommandlineMarker createMarker( )

Return a marker.

This marker can be used to locate a position on the commandline - to insert something for example - when all parameters have been set.




Tags:

access:  public


[ Top ]

method describeArguments [line 348]

string describeArguments( [$args $args = null], [$offset $offset = 0])

Returns a String that describes the arguments suitable for

verbose output before a call to




Tags:

access:  protected


Parameters:

$args   $args   arguments to use (default is to use current class args)
$offset   $offset   ignore entries before this index

[ Top ]

method describeCommand [line 318]

string describeCommand( [array $args = null])

Returns a String that describes the command and arguments suitable for verbose output before a call to

This method assumes that the first entry in the array is the executable to run.




Tags:

access:  public


Parameters:

array   $args   CommandlineArgument[] to use

[ Top ]

method getArguments [line 133]

void getArguments( )

Returns all arguments defined by
  1. addLine
,
  1. addValue
or the argument object.



Tags:

access:  public


[ Top ]

method getCommandline [line 120]

array getCommandline( )

Returns the executable and all defined arguments.



Tags:

access:  public


[ Top ]

method getExecutable [line 106]

void getExecutable( )



Tags:

access:  public


[ Top ]

method setExecutable [line 97]

void setExecutable( $executable)

Sets the executable to run.



Tags:

access:  public


Parameters:

   $executable  

[ Top ]

method size [line 270]

int size( )



Tags:

return:  Number of components in current commandline.
access:  public


[ Top ]

method __copy [line 274]

void __copy( )



Tags:

access:  public


[ Top ]

method __toString [line 146]

void __toString( )



Tags:

access:  public


[ Top ]


Class Constants

DISCLAIMER =  "The ' characters around the executable and arguments are not part of the command."

[line 59]


[ Top ]



Documentation generated on Mon, 19 Oct 2009 10:50:33 +0200 by phpDocumentor 1.4.3