Skip to content

Repository files navigation

un shell

Set your shell free !

Combine PHP and shell command.

Features

  • Light: No dependencies
  • Async: Work Asynchronously
  • Testable: Unshell script are easily testable because they yield execution control

Setup

composer require romainprignon/unshell

Usage

Execute script through Shell

Execute 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.php

Embedded script inside apps

Given the precedent script pause.php

fromunshellimportUnshellimportosdefmain():
script=resolve('./scripts/pause.js') # resolve your python moduletry:
Unshell({"env": os.environ})(script)
exceptExceptionaserr:
print(err)

Examples

Here is some examples of what you can do with unshell

Contribute

poetry config --local virtualenvs.in-project true
poetry shell
make install
watch make dev

License

The code is available under the MIT license.

TODO

  • everything

About

Set your shell free !

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages