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 = yield from fetchContainerIds();
for $id in $ids:
yield "docker pause {$id}";
function fetchContainerIds():
$ids = yield "docker ps -q --no-trunc";
return explode("\n", $ids);Run it through unshell
unshell run pause.phpGiven the precedent script pause.php
from unshell import Unshell
import os
def main():
script = resolve('./scripts/pause.js') # resolve your python module
try:
Unshell({"env": os.environ})(script)
except Exception as err:
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
