Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed Dec 5, 2013
0 parents commit a7a52ae
Show file tree
Hide file tree
Showing 50 changed files with 3,824 additions and 0 deletions.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2013 Sébastien Eustace

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include README.md LICENSE
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Cleo
====

Cleo is a Python port of the [Symfony Console Component](https://github.com/symfony/Console).
It eases the creation of beautiful and testable command line interfaces.

The Application object manages the CLI application:

from cleo import Application

console = Application()
console->run()

The ``run()`` method parses the arguments and options passed on the command
line and executes the right command.

Registering a new command can easily be done via the ``register()`` method,
which returns a ``Command`` instance:

from cleo.input import InputArgument, InputOption

def ls_dir(input_, output_):
dir = input_.get_argument('dir')

output.writeln('Dir listing for <info>%s</info>' % dir)

console
.register('ls')
.set_definition([
InputArgument('dir', InputArgument.REQUIRED, 'Directory name'),
])
.set_description('Displays the files in the given directory')
.set_code(ls_dir)

You can also register new commands via classes.

Cleo provides a lot of features like output coloring, input and
output abstractions (so that you can easily unit-test your commands),
validation, automatic help messages, ...

Tests
-----

You can run the unit tests with the following command:

$ nosetests tests
33 changes: 33 additions & 0 deletions cleo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-

from .application import Application
from .command import Command
from .formatter import *
from .helper import *
from .input import *
from .output import *
from .tester import *

__all__ = [
'Application',
'Command',
'OutputFormatter',
'OutputFormatterStyle',
'OutputFormatterStyleStack',
'Helper',
'DialogHelper',
'ProgressHelper',
'HelperSet',
'FormatterHelper',
'Input',
'InputDefinition',
'InputArgument',
'InputOption',
'ArgvInput',
'ListInput',
'Output',
'ConsoleOutput',
'StreamOutput',
'ApplicationTester',
'CommandTester'
]
Loading

0 comments on commit a7a52ae

Please sign in to comment.