diff options
-rw-r--r-- | README.rst | 8 | ||||
-rw-r--r-- | cliff/formatters/value.py | 15 | ||||
-rw-r--r-- | cliff/interactive.py | 3 | ||||
-rw-r--r-- | cliff/tests/test_formatters_value.py | 15 | ||||
-rw-r--r-- | docs/source/conf.py | 6 | ||||
-rw-r--r-- | requirements.txt | 6 | ||||
-rw-r--r-- | setup.cfg | 1 | ||||
-rw-r--r-- | test-requirements.txt | 7 |
8 files changed, 46 insertions, 15 deletions
@@ -6,7 +6,7 @@ cliff is a framework for building command line programs. It uses setuptools entry points to provide subcommands, output formatters, and other extensions. -Documentation -============= - -Documentation for cliff is hosted on readthedocs.org at http://readthedocs.org/docs/cliff/en/latest/ +* Free software: Apache license +* Documentation: http://cliff.readthedocs.org +* Source: http://git.openstack.org/cgit/openstack/cliff +* Bugs: https://bugs.launchpad.net/python-cliff diff --git a/cliff/formatters/value.py b/cliff/formatters/value.py new file mode 100644 index 0000000..9910319 --- /dev/null +++ b/cliff/formatters/value.py @@ -0,0 +1,15 @@ +"""Output formatters values only +""" + +from .base import SingleFormatter + + +class ValueFormatter(SingleFormatter): + + def add_argument_group(self, parser): + pass + + def emit_one(self, column_names, data, stdout, parsed_args): + for value in data: + stdout.write('%s\n' % str(value)) + return diff --git a/cliff/interactive.py b/cliff/interactive.py index 619c4a2..e1bd930 100644 --- a/cliff/interactive.py +++ b/cliff/interactive.py @@ -113,3 +113,6 @@ class InteractiveApp(cmd2.Cmd): statement.parsed.command = cmd_name statement.parsed.args = ' '.join(sub_argv) return statement + + def cmdloop(self): + self._cmdloop() diff --git a/cliff/tests/test_formatters_value.py b/cliff/tests/test_formatters_value.py new file mode 100644 index 0000000..25fb23d --- /dev/null +++ b/cliff/tests/test_formatters_value.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +from six import StringIO + +from cliff.formatters import value + + +def test_value_formatter(): + sf = value.ValueFormatter() + c = ('a', 'b', 'c', 'd') + d = ('A', 'B', 'C', '"no escape me"') + expected = 'A\nB\nC\n"no escape me"\n' + output = StringIO() + sf.emit_one(c, d, output, None) + actual = output.getvalue() + assert expected == actual diff --git a/docs/source/conf.py b/docs/source/conf.py index 131a9f9..f58e7b8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -51,10 +51,8 @@ copyright = u'2012-%s, Doug Hellmann' % datetime.datetime.today().year # built documents. # # The short X.Y version. -version = subprocess.check_output([ - 'sh', '-c', - 'cd ../..; python setup.py --version', -]) +version = subprocess.Popen(['cd ../..; python setup.py --version'], + shell=True, stdout=subprocess.PIPE).stdout.read() version = version.strip() # The full version, including alpha/beta/rc tags. release = version diff --git a/requirements.txt b/requirements.txt index a1d90fa..f91e2e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ argparse cmd2>=0.6.7 -PrettyTable>=0.6,<0.8 +PrettyTable>=0.7,<0.8 pyparsing>=2.0.1 -six -stevedore +six>=1.4.1 +stevedore>=0.12 @@ -33,6 +33,7 @@ cliff.formatter.list = cliff.formatter.show = table = cliff.formatters.table:TableFormatter shell = cliff.formatters.shell:ShellFormatter + value = cliff.formatters.value:ValueFormatter cliff.formatter.completion = bash = cliff.complete:CompleteBash diff --git a/test-requirements.txt b/test-requirements.txt index 85c0039..619f5d9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,5 @@ nose -mock -coverage -pep8 +mock>=1.0 +coverage>=3.6 cmd2 -PrettyTable +PrettyTable>=0.7,<0.8 |