Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meitham/pygnutools
Pure python implementation of GNU tools
https://github.com/meitham/pygnutools
Last synced: 2 months ago
JSON representation
Pure python implementation of GNU tools
- Host: GitHub
- URL: https://github.com/meitham/pygnutools
- Owner: meitham
- License: bsd-3-clause
- Created: 2012-12-30T17:58:06.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-01-27T19:31:50.000Z (almost 12 years ago)
- Last Synced: 2024-08-04T04:04:05.619Z (4 months ago)
- Language: Python
- Size: 154 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
- starred-awesome - pygnutools - Pure python implementation of GNU tools (Python)
README
==========
pygnutools
==========pygnutools is an implementation of the GNU tools in pure Python.
Work in Progress
================So far the only implemented tool is ``find`` tool. Not even all find primaries are implemented yet.
Plugin Architecture
===================Unlike the GNU find tool, this implementation allows plugins to be easily added.
The plugin architecture uses setuptools entry points.See exivfind_ as an example that provides pyfind with EXIF primaries.
.. _exivfind: https://github.com/meitham/exivfind
for example with installing exivfind_ you could do::
pyfind ~/Pictures -iname \*.jpg -imake canon -print ', ' -print-tag 'model'
The command above will look through your pictures directory for all files
matching *.jpg and are taking by a canon camera, then will print the file name
followed by a comma and space ', ' and print the model of the camera. Neat!Options prefixed with i denote case insensitivity.
Unlike GNU find, ``-print`` takes an optional single argument that is used as
a suffix after the filepath.Difference from GNU find
========================This tools is not and will not be fully compatable with GNU find. For example
GNU find inserts the ``-print`` implictly for you, where this tool won't.
The reason for this is GNU find is oriented around filenames, a test match will
give you back the file name that you after, where as this tool can do a lot
more than that, such as print something from the ``context`` object that was
populated by one of the primaries.If you're interested in printing the file names you could always do that by
explicitly provide the ``-print`` primary. I can argue we are honoring the zen
of python that explicit is better than implcit.Getting Started
===============Clone::
git clone https://github.com/meitham/pygnutools
Install::
cd pygnutools && python setup.py install
Run Examples::
pyfind . -name \*.pyc -print
pyfind some_path -iname \*.png -exec rm \{} \;
License
=======See LICENCE file