Commit 7f89e718 authored by ∞'s avatar 💻

Cleanup README

parent e01168fb
Pipeline #1813 failed with stages
in 16 seconds
......@@ -8,14 +8,18 @@ any code, typically when automating stuff, cli2 unfrustrates me::
cli2 yourmodule.yourcallback somearg somekwarg=foo
Sometimes I just want to define a new command and expose all callables in a
module and I can't just do it with a one-liner. cli2 unfrustrates me::
module and I can't just do it with a one-liner. cli2 unfrustrates me again:
.. code-block:: python
console_script = cli2.ConsoleScript(__doc__).add_module('mymodule')
# then i add console_script entrypoint as such: mycmd = mycmd.console_script
I also like when readonly commands are in green, writing commands in yellow and
destructive commands in red, I find the commands list in the help output more
readable, and directive for new users of the CLI::
readable, and directive for new users of the CLI:
.. code-block:: python
@cli2.config(color=cli2.RED)
def challenge(dir):
......@@ -27,7 +31,9 @@ Of course then there's all this code I need to have coverage for and I'm
<https://pypi.org/project/django-dbdiff/>`_ so lazy that I still
`don't write most of my test code myself
<https://pypi.org/project/django-responsediff/>`_, so I throwed an autotest
function in cli2 that I can use as such::
function in cli2 ("ala" dbunit with a personal touch) that I can use as such:
.. code-block:: python
@pytest.mark.parametrize('name,command', [
('cli2', ''),
......@@ -42,21 +48,11 @@ function in cli2 that I can use as such::
'cli2 ' + command,
)
This got me to 86% coverage in 3 minutes. How so ?
Well, it will execute the command and compare with the contents in the test
text file with GNU or busybox diff and fail if there's a diff. If the file
doesn't exist then it will create it and fail because it created the fixture. I
can just rm -rf my tests dir and run pytest again, and use git diff to see what
has changed.
You should be able tho pip install cli2 and start using the cli2 command, or
cli2.ConsoleScript to make your own commands.
.. image:: https://asciinema.org/a/221137.svg
:target: https://asciinema.org/a/221137
Projects using cli2 so far:
- `djcli
<https://pypi.org/project/djcli>`_,
Check `djcli, another cli built on cli2
<https://pypi.org/project/djcli>`_.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment