changeset 0:6670fe246450

initial commit
author Jeff Hammel <k0scist@gmail.com>
date Thu, 14 Jul 2016 12:27:21 -0700
parents
children dd3f3918cb88
files README.txt a8e.py setup.py
diffstat 3 files changed, 73 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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
+
--- /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()
+  
--- /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
+      """,
+      )
+