Set your shell free !
Combine PHP and shell command.
- Light: No dependencies
- Async: Work Asynchronously
- Testable: Unshell script are easily testable because they yield execution control
composer require romainprignon/unshellExecute script through unshell runtime
Usage:
unshell COMMAND [SCRIPT_PATH] [ARGS...]
Commands:
help Print this help message
run run a script through unshell runtime
Given the script: pause.php to pause all docker containers
function pause():
$ids = yieldfromfetchContainerIds();
for$id in $ids:
yield"docker pause {$id}";
function fetchContainerIds():
$ids = yield"docker ps -q --no-trunc";
returnexplode("\n", $ids);Run it through unshell
unshell run pause.phpGiven the precedent script pause.php
fromunshellimportUnshellimportosdefmain():
script=resolve('./scripts/pause.js') # resolve your python moduletry:
Unshell({"env": os.environ})(script)
exceptExceptionaserr:
print(err)Here is some examples of what you can do with unshell
poetry config --local virtualenvs.in-project true
poetry shell
make install
watch make devThe code is available under the MIT license.
- everything
