This pull request adds the ability to resolve multiple commands, like #279 but by adding a new method instead of overloading the existing one.
use lang\Process;
// Resolve either docker or podman. Will contain NULL if neither is found.
$containers= Process::locate(['docker', 'podman'])->current();
// See which command was resolved and compose command line accordingly
$locate= Process::locate(['curl', 'wget']);
$download= match ($locate->key()) {
'curl' => fn($url, $target) => $locate->current().' "-#" -L "'.$url.'" -o "'.$target.'"',
'wget' => fn($url, $target) => $locate->current().' -nv "'.$url.'" -O "'.$target.'"',
default => throw new IllegalArgumentException('Either curl or wget is required'),
};
This pull request adds the ability to resolve multiple commands, like #279 but by adding a new method instead of overloading the existing one.