A library of small functions that simplify scripting in python
Project description
pysh
A library of small functions that simplify scripting in python
Installation
pip install pysh
Usage
sh
Run a shell command and display the output:
sh("git status")
Capture the output of a shell command:
res = sh("git status", capture=True)
print(res.stdout)
cd
Change the current working directory:
cd("path/to/dir")
Change the current working directory temporarily:
with cd("path/to/dir"):
sh("git status")
env
Set an environment variable:
env(var="value")
Set an environment variable temporarily:
with env(PGPASSWORD="MyPassword", PGUSER="postgres"):
sh("createdb -h localhost -p 5432 -O postgres mydb")
which
Checks whether an executable/script/builtin is available:
git_is_installed = which("git")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pysh-3.3.1.tar.gz
(3.1 kB
view hashes)
Built Distribution
pysh-3.3.1-py3-none-any.whl
(3.2 kB
view hashes)