Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chtenb/python-shellout
Thin convenience wrappers for shelling out commands easily from python
https://github.com/chtenb/python-shellout
Last synced: 21 days ago
JSON representation
Thin convenience wrappers for shelling out commands easily from python
- Host: GitHub
- URL: https://github.com/chtenb/python-shellout
- Owner: chtenb
- License: gpl-3.0
- Created: 2016-04-01T15:55:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-05-21T14:27:08.000Z (over 3 years ago)
- Last Synced: 2024-12-01T00:06:04.460Z (22 days ago)
- Language: Python
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![PyPI version](https://badge.fury.io/py/pyshellout.svg)](https://badge.fury.io/py/pyshellout)
# python-shellout
Thin convenience wrappers for shelling out commands easily from python## Installation
In shell with enough admin rights type
```bash
$ git clone https://github.com/Chiel92/python-shellout
$ cd python-shellout
$ python3 setup.py install
```Or to obtain the version from PyPI do
```bash
$ pip install pyshellout
```## Example Usage
```python
from pyshellout import getfiles=get('find . -name "*.cpp" -o -name "*.h" -print0')
for f in files.z: # Iterate filenames separated by null bytes
print('Current file: ' + f)
matches=get("grep -zZ 'some multiline regex pattern' '{}'", f) # Allows string formatting
print(matches.z)
```A more elaborate example can be found on [this blog post about automatically archiving merged
git branches.][archive-git-branches]
Or on this [this blog post about automatically delete merged local git branches.][delete-git-branches].[delete-git-branches]: http://ctenbrinke.net/2016/06/16/deleting-merged-local-branches-in-git/
[archive-git-branches]: http://ctenbrinke.net/2016/06/07/archiving-branches-with-git/