summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVal Neekman <un33kvu@gmail.com>2014-08-16 21:35:08 -0400
committerVal Neekman <un33kvu@gmail.com>2014-08-16 21:35:08 -0400
commit152827ae8f84e9b89db21bde18c052467bbaf293 (patch)
tree67525edd41d19269ae6177d1fa145ed5ed382ae2
parent52108c39d2a7c53def6bf55ddb0c81b185bb211a (diff)
parent8d024259a5a140777d2ed3a3a3a7089a8d0ba330 (diff)
downloadpython-slugify-152827ae8f84e9b89db21bde18c052467bbaf293.tar.gz
Merge pull request #5 from ekamil/master
Console entry point
-rwxr-xr-xsetup.py1
-rw-r--r--slugify/__init__.py8
2 files changed, 9 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index e9d0855..cdfe3a2 100755
--- a/setup.py
+++ b/setup.py
@@ -80,4 +80,5 @@ setup(
install_requires=install_requires,
classifiers=classifiers,
use_2to3=True,
+ entry_points={'console_scripts': ['slugify=slugify:main']},
)
diff --git a/slugify/__init__.py b/slugify/__init__.py
index 2905a88..0ff57f0 100644
--- a/slugify/__init__.py
+++ b/slugify/__init__.py
@@ -104,3 +104,11 @@ def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0, w
text = text.replace('-', separator)
return text
+
+
+def main():
+ if len(sys.argv) < 2:
+ print "Usage %s TEXT TO SLUGIFY" % sys.argv[0]
+ return
+ text = ' '.join(sys.argv[1:])
+ print slugify(text)