Skip to content

Commit

Permalink
Changing the way to use it. Version 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
magmax committed May 25, 2014
1 parent 174964d commit bdef090
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
26 changes: 20 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,35 @@ VERSION DOWNLOADS TESTS COVERAGE
============== =============== ========= ============


Usage
-----
Installation and Usage
----------------------

Currently there are two way to use it:
Two options: to install it in your system/project::

pip install colorize

And you can use it with::

python -m colorize -h


Or just `download the lastest zip`_ and use it with::

python colorize-X.Y.Z.zip -h


Now, you have two ways to use it:

Rendering the output
~~~~~~~~~~~~~~~~~~~~

Just execute::

$ command to execute | colorize.py
$ command to execute | python -m colorize

If you need to render both the stdout and the stderr::

$ command to execute |& colorize.py
$ command to execute |& python -m colorize

This method works well with too long outputs

Expand All @@ -33,7 +47,7 @@ As runner

Other way to use it:

$ colorize.py command to execute
$ python -m colorize command to execute

This method can do disgusting things with too long outputs.

Expand Down
2 changes: 1 addition & 1 deletion colorize/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.1.0"
__version__ = "0.2.0"
__description__ = "Command line utility to colorize other commands output",
11 changes: 0 additions & 11 deletions colorize/colorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,3 @@ def replace(self, line):
for exp, color in self.regexps.items():
result, _ = re.subn(exp, color, result)
return result


def main():
conf = Configuration()
conf.process()
colorize = Colorize(conf)
colorize.run()
sys.exit(colorize.return_code)

if __name__ == '__main__':
main()
4 changes: 2 additions & 2 deletions tests/features/test_colorize_executed_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

class stdin_is_colorized_test(unittest.TestCase):
def test_valid_output(self):
self.sut = pexpect.spawn('./colorize/colorize.py echo FAILURE',
self.sut = pexpect.spawn('python -m colorize echo FAILURE',
timeout=1)

self.sut.expect_exact('\x1b[1;37;41mFAILURE\x1b[m')
self.assertEquals(0, self.sut.wait())

def test_returns_2_if_child_returns_2(self):
self.sut = pexpect.spawn('./colorize/colorize.py ls /foo',
self.sut = pexpect.spawn('python -m colorize ls /foo',
timeout=1)

self.assertEquals(2, self.sut.wait())
2 changes: 1 addition & 1 deletion tests/features/test_colorize_stdin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class stdin_is_colorized_test(unittest.TestCase):
def setUp(self):
self.sut = pexpect.spawn('./colorize/colorize.py', timeout=1)
self.sut = pexpect.spawn('python -m colorize', timeout=1)

def test_normal_output(self):
self.sut.sendline('example')
Expand Down

0 comments on commit bdef090

Please sign in to comment.