-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a7a52ae
Showing
50 changed files
with
3,824 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include README.md LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
] |
Oops, something went wrong.