Skip to content

Commit

Permalink
Make CLI cross platform
Browse files Browse the repository at this point in the history
Using scripts makes it hard to use on windows. This works on all
platforms.
  • Loading branch information
Tarjei Husøy committed Feb 28, 2014
1 parent b5d05c6 commit ae3083e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
15 changes: 0 additions & 15 deletions bin/xerox

This file was deleted.

6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def publish():
author_email='me@kennethreitz.com',
url='http://github.com/kennethreitz/xerox',
packages=['xerox'],
scripts=['bin/xerox'],
entry_points={
'console_scripts': [
'xerox = xerox:main',
]
},
license='MIT',
classifiers=(
"Development Status :: 4 - Beta",
Expand Down
11 changes: 11 additions & 0 deletions xerox/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
from .core import *

import sys

def main():
""" Entry point for cli. """
if sys.argv[1:]: # called with input arguments
copy(' '.join(sys.argv[1:]))
elif not sys.stdin.isatty(): # piped in input
copy('\n'.join(sys.stdin.readlines()))
else: # paste output
print(paste())

0 comments on commit ae3083e

Please sign in to comment.