A python implementation for GNU utils
Project description
Description
pygnuutils
is a pure python implementation for GNU utils.
Installation
Install the last released version using pip
:
python3 -m pip install --user -U pygnuutils
Or install the latest version from sources:
git clone git@github.com:matan1008/pygnuutils.git
cd pygnuutils
python3 -m pip install --user -U -e .
Usage
CLI
You can run commands by using pygnuutils prefix. For example, in order to list /tmp/foo
you can run:
pygnuutils ls -lRh /tmp/foo
Python
To use pygnuutils
you can write the following:
from pygnuutils.ls import Ls
ls = Ls()
ls('/tmp', all_=True)
Perhaps the best reason to use this library instead of gnu is the dependency injection ability.
For example, in order to print a message each time a symlink is resolved:
import os
from pygnuutils.ls import Ls, LsStub
class ReadlinkWatch(LsStub):
def readlink(self, path, dir_fd=None):
print(f'Resolving {path}...')
return os.readlink(path, dir_fd=dir_fd)
ls = Ls(stub=ReadlinkWatch())
ls('/tmp', all_=True, long=True)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pygnuutils-0.0.6.tar.gz
(32.0 kB
view hashes)
Built Distribution
pygnuutils-0.0.6-py3-none-any.whl
(33.8 kB
view hashes)
Close
Hashes for pygnuutils-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c54187173ef3bc8f1ed1a017f0cef8e445ce6ee538817c61b33bb9f0ba72d842 |
|
MD5 | 8b6fb232c6578732391f5f03c3920aa3 |
|
BLAKE2b-256 | d46e4bfd451acd2d220e9da69cec044823a8369efa8f688bd836e0ca2703ab91 |