« »

eol.py 0.7.4 -- Python 3 support

Tuesday, 13 July 2010


What's new?

  • Python 3 support (not heavily tested yet)
  • Starter test suite

Full changelog: http://github.com/trentm/eol/tree/master/CHANGES.md#files

What is ‘eol’?

eol is both a command-line script eol and a Python module eol for working with end-of-line chars in text files.

Command line usage

# list EOL-style of files
$ eol *
configure: Unix (LF)
build.bat: Windows (CRLF)
snafu.txt: Mixed, predominantly Unix (LF)

# find files with a given EOL-style
$ eol -f CRLF -x .svn -r ~/src/python

# convert EOL-style of files
$ eol -c LF foo.c 
converted `foo.c' to LF EOLs

Module usage

>>> import eol
>>> eol.eol_info_from_path("configure")
('\n', '\n')         # (<detected-eols>, <suggested-eols>)
>>> eol.eol_info_from_path("build.bat")
('\r\n', '\r\n')
>>> eol.eol_info_from_path("snafu.txt")
(<class 'eol.MIXED'>, '\n')

See the README for full usage information.

Tagged: python, programming


blog comments powered by Disqus