# HG changeset patch # User Jeff Hammel # Date 1468524441 25200 # Node ID 6670fe246450bef1f0f574c559fa6d6ed0521602 initial commit diff -r 000000000000 -r 6670fe246450 README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.txt Thu Jul 14 12:27:21 2016 -0700 @@ -0,0 +1,11 @@ +a8e +=========== + +a8e is `a8e abbreviate` + +---- + +Jeff Hammel + +http://k0s.org/hg/a8e + diff -r 000000000000 -r 6670fe246450 a8e.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/a8e.py Thu Jul 14 12:27:21 2016 -0700 @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +import sys +import urllib2 + +def a8e(text): + text = text.split() + retval = [] + for word in text: + if len(word) < 4: + retval.append(word) + else: + retval.append(word[0] + '%d' % (len(word) - 2) + word[-1]) + return ' '.join(retval) + +def main(args=sys.argv[1:]): + if len(args) == 1 and (args[0].startswith('http://') + or args[0].startswith('https://')): + text = urllib2.urlopen(args[0]).read() + else: + text = ' '.join(args) + # TODO: read from stdin if no args + print a8e(text) + +if __name__ == '__main__': + main() + diff -r 000000000000 -r 6670fe246450 setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup.py Thu Jul 14 12:27:21 2016 -0700 @@ -0,0 +1,35 @@ +import os +from setuptools import setup + +try: + here = os.path.dirname(os.path.abspath(__file__)) + description = file(os.path.join(here, 'README.txt')).read() +except IOError: + description = None + +version = '0.0' + +deps = [] + +setup(name='a8e', + version=version, + description="a8e is `a8e abbreviate`", + long_description=description, + classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers + keywords='', + author='Jeff Hammel', + author_email='k0scist@gmail.com', + url='http://k0s.org/hg/a8e', + license='', + py_modules=['a8e'], + packages=[], + include_package_data=True, + zip_safe=False, + install_requires=deps, + entry_points=""" + # -*- Entry points: -*- + [console_scripts] + a8e = a8e:main + """, + ) +