Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehaertl committed Dec 3, 2021
1 parent e8cbcde commit 6c716ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ pass `command`, `execCommand` and `args` as options. This will call the respecti

* `__construct($options = null)`
* `$options`: either a command string or an options array (see `setOptions()`)
* `__toString()`: The result from `getExecCommand()`
* `setOptions($options)`: Set command options
* `$options`: array of name => value options that should be applied to the object.
You can also pass options that use a setter, e.g. you can pass a `command` option which
Expand All @@ -176,22 +177,27 @@ pass `command`, `execCommand` and `args` as options. This will call the respecti
* `getCommand()`: The command that was set through `setCommand()` or passed to the constructor.
* `getExecCommand()`: The full command string to execute.
* `setArgs($args)`: Set argument as string
* `$args`: The command arguments as string. Note, that these will not get escaped!
* `$args`: The command arguments as string. Note, that these will not get escaped. This
will overwrite the args added with `addArgs()`.
* `getArgs()`: The command arguments that where set through `setArgs()` or `addArg()`, as string
* `addArg($key, $value=null, $escape=null)`: Add argument with correct escaping
* `$key`: The argument key to add e.g. `--feature` or `--name=`. If the key does not end with
and `=`, the `$value` will be separated by a space, if any. Keys are not escaped unless
`$value` is null and `$escape` is `true`.
* `$value`: The optional argument value which will get escaped if `$escapeArgs` is true.
and `=`, the (optional) `$value` will be separated by a space. The key will get
escaped if `$escapeArgs` is `true`.
* `$value`: The optional argument value which will get escaped if `$escapeArgs` is `true`.
An array can be passed to add more than one value for a key, e.g. `addArg('--exclude', array('val1','val2'))`
which will create the option "--exclude 'val1' 'val2'".
* `$escape`: If set, this overrides the `$escapeArgs` setting and enforces escaping/no escaping
* `setStdIn()`: String or resource to supply to command via standard input.
This enables the same functionality as piping on the command line. It can
also be a resource like a file handle or a stream in which case its content
will be piped into the command like an input redirection.
* `getOutput()`: The command output as string. Empty if none.
* `getError()`: The error message, either stderr or internal message. Empty if no error.
* `getStdErr()`: The stderr output. Empty if none.
* `getExitCode()`: The exit code.
* `getExitCode()`: The exit code or `null` if command was not executed.
* `getExecuted()`: Whether the command was successfully executed.
* `getIsWindows()`: Whether we are on a Windows Owe are on a Windows OS
* `execute()`: Executes the command and returns `true` on success, `false` otherwhise.

> **Note:** `getError()`, `getStdErr()` and `getOutput()` return the trimmed output.
Expand Down
2 changes: 1 addition & 1 deletion src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public function getArgs()
/**
* @param string $key the argument key to add e.g. `--feature` or
* `--name=`. If the key does not end with `=`, the (optional) $value will
* be separated by a space.
* be separated by a space. The key will get escaped if `$escapeArgs` is `true`.
* @param string|array|null $value the optional argument value which will
* get escaped if $escapeArgs is true. An array can be passed to add more
* than one value for a key, e.g.
Expand Down

0 comments on commit 6c716ad

Please sign in to comment.