|
@@ 83-89 (lines=7) @@
|
| 80 |
|
* Concatenate multiple shell commands via piping |
| 81 |
|
* @return Shell The piped shell command |
| 82 |
|
*/ |
| 83 |
|
public static function pipe(/* ... */){ |
| 84 |
|
$cmd = []; |
| 85 |
|
foreach (func_get_args() as $item) { |
| 86 |
|
$cmd[] = ($item instanceof static)?$item->getShellCommand():$item; |
| 87 |
|
} |
| 88 |
|
return new static(implode(' | ',$cmd)); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
/** |
| 92 |
|
* Concatenate multiple shell commands via logical implication ( && ) |
|
@@ 95-101 (lines=7) @@
|
| 92 |
|
* Concatenate multiple shell commands via logical implication ( && ) |
| 93 |
|
* @return Shell The concatenated shell command |
| 94 |
|
*/ |
| 95 |
|
public static function sequence(...$items){ |
| 96 |
|
$cmd = []; |
| 97 |
|
foreach ($items as $item) { |
| 98 |
|
$cmd[] = ($item instanceof static)?$item->getShellCommand():$item; |
| 99 |
|
} |
| 100 |
|
return new static(implode(' && ',$cmd)); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
public static function execCommand($command,$params = null){ |
| 104 |
|
return new static($command,$params); |