From 35ec821e37544483fa2407f29db764c5696656ae Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 21 Mar 2011 22:36:34 -0400 Subject: [PATCH 01/16] case typo --- test_clint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_clint.py b/test_clint.py index cede7da..75772f3 100755 --- a/test_clint.py +++ b/test_clint.py @@ -6,7 +6,7 @@ import unittest -class TablibTestCase(unittest.TestCas): +class TablibTestCase(unittest.TestCase): """Tablib test cases.""" def setUp(self): From 5366c7e5b2f2542d18c611e16724e2387f161aeb Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 21 Mar 2011 23:53:16 -0400 Subject: [PATCH 02/16] not_files should return Args object. --- clint/arguments.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clint/arguments.py b/clint/arguments.py index c87ee67..57742ff 100644 --- a/clint/arguments.py +++ b/clint/arguments.py @@ -343,7 +343,8 @@ class Args(object): if not os.path.exists(arg): _args.append(arg) - return _args + return Args(_args, no_argv=True) + @property def copy(self): From f0206b21fc217223780bbf4e1be46a0226233f51 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 22 Mar 2011 01:00:10 -0400 Subject: [PATCH 03/16] fix for found arg at pos 0 --- clint/arguments.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/clint/arguments.py b/clint/arguments.py index 57742ff..b261c2e 100644 --- a/clint/arguments.py +++ b/clint/arguments.py @@ -25,19 +25,19 @@ __all__ = ('Args', ) def _expand_path(path): - """Expands directories and globs in given path.""" + """Expands directories and globs in given path.""" - paths = [] + paths = [] - if os.path.isdir(path): + if os.path.isdir(path): - for (dir, dirs, files) in os.walk(path): - for file in files: - paths.append(os.path.join(dir, file)) - else: - paths.extend(glob(path)) + for (dir, dirs, files) in os.walk(path): + for file in files: + paths.append(os.path.join(dir, file)) + else: + paths.extend(glob(path)) - return paths + return paths class Args(object): @@ -69,7 +69,7 @@ class Args(object): def __contains__(self, x): - return bool(self.first(x)) + return self.first(x) is not None def get(self, x): @@ -133,7 +133,7 @@ class Args(object): if is_collection(x): for item in x: found = _find(item) - if found: + if found is not None: return found return None else: @@ -345,7 +345,6 @@ class Args(object): return Args(_args, no_argv=True) - @property def copy(self): """Returns a copy of Args object for temporary manipulation.""" From ebdb04848a3d3859afdecda8649967920679bd2c Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 22 Mar 2011 01:17:16 -0400 Subject: [PATCH 04/16] fix for found arg at pos 0 --- clint/arguments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clint/arguments.py b/clint/arguments.py index b261c2e..76d643e 100644 --- a/clint/arguments.py +++ b/clint/arguments.py @@ -90,7 +90,7 @@ class Args(object): def _remove(x): found = self.first(x) - if found: + if found is not None: self._args.pop(found) if is_collection(x): From fc3eeca54fd6ad8c5fd178db4ec98d7b0ca7f6cd Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 22 Mar 2011 03:05:04 -0400 Subject: [PATCH 05/16] :octocat: says: 'the :cake: is a lie!' --- test_clint.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test_clint.py b/test_clint.py index 75772f3..e9e0b9f 100755 --- a/test_clint.py +++ b/test_clint.py @@ -16,7 +16,5 @@ class TablibTestCase(unittest.TestCase): def tearDown(self): pass - - if __name__ == '__main__': unittest.main() From f6a20fc4134a7809498c091226056912b2f7cd09 Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 03:11:18 -0400 Subject: [PATCH 06/16] test commit --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 8833727..a035ca3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include HISTORY.rst README.rst LICENSE AUTHORS NOTICE \ No newline at end of file +include HISTORY.rst README.rst LICENSE AUTHORS NOTICE \ No newline at end of file From 14c4cdf904968c92eb7b39810436c18acf97264a Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 04:18:25 -0400 Subject: [PATCH 07/16] Added utils.schunk() for bytes chunking --- clint/utils.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/clint/utils.py b/clint/utils.py index 4829976..4d1257b 100644 --- a/clint/utils.py +++ b/clint/utils.py @@ -49,3 +49,24 @@ def tsplit(string, delimiters): return stack +def schunk(string, size): + """Splits string into n sized chunks.""" + + stack = [] + + substack = [] + current_count = 0 + + for char in string: + if not current_count < size: + stack.append(''.join(substack)) + substack = [] + current_count = 0 + + substack.append(char) + current_count += 1 + + if len(substack): + stack.append(''.join(substack)) + + return stack From 76bee9c4ba51681fc38365f1afb185281914eb75 Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 04:35:38 -0400 Subject: [PATCH 08/16] max_width in place. --- clint/textui/formatters.py | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 clint/textui/formatters.py diff --git a/clint/textui/formatters.py b/clint/textui/formatters.py new file mode 100644 index 0000000..e9511e9 --- /dev/null +++ b/clint/textui/formatters.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +""" +clint.textui.formatters +~~~~~~~~~~~~~~~~~~~~~~~ + +Core TextUI functionality for text formatting. + +""" + +from __future__ import absolute_import + +from ..utils import tsplit, schunk + + +NEWLINES = ('\n', '\r', '\r\n') + + + + +def min_width(string, cols, padding=' '): + """Returns given string with right padding.""" + + stack = tsplit(string, NEWLINES) + + for i, substring in enumerate(stack): + stack[i] = substring.ljust(cols, padding) + + return '\n'.join(stack) + + +def max_width(string, cols, separator='\n'): + """Returns a freshly formatted """ + + stack = tsplit(string, NEWLINES) + + for i, substring in enumerate(stack): + stack[i] = substring.split() + + _stack = [] + + for row in stack: + _row = ['',] + _row_i = 0 + + for word in row: + if (len(_row[_row_i]) + len(word)) < cols: + _row[_row_i] += word + _row[_row_i] += ' ' + + elif len(word) > cols: + + # ensure empty row + if len(_row[_row_i]): + _row.append('') + _row_i += 1 + + chunks = schunk(word, cols) + for i, chunk in enumerate(chunks): + if not (i + 1) == len(chunks): + _row[_row_i] += chunk + _row.append('') + _row_i += 1 + else: + _row[_row_i] += chunk + _row[_row_i] += ' ' + else: + _row.append('') + _row_i += 1 + _row[_row_i] += word + _row[_row_i] += ' ' + _stack.append(separator.join(_row)) + + + return '\n'.join(_stack) From 2cd9bd52637daf8158a38d3aeca346b47d10f1b1 Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 04:36:01 -0400 Subject: [PATCH 09/16] min/max widths in textui core configurable newlines --- clint/textui/core.py | 8 ++++++-- examples/text_width.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 examples/text_width.py diff --git a/clint/textui/core.py b/clint/textui/core.py index e7738bd..4300e9d 100644 --- a/clint/textui/core.py +++ b/clint/textui/core.py @@ -14,15 +14,19 @@ from __future__ import absolute_import import sys from .progress import progressbar +from .formatters import max_width, min_width from ..utils import tsplit -__all__ = ('puts', 'puts_err', 'indent', 'progressbar') +__all__ = ('puts', 'puts_err', 'indent', 'progressbar', 'max_width', 'min_width') STDOUT = sys.stdout.write STDERR = sys.stderr.write +NEWLINES = ('\n', '\r', '\r\n') + + class Writer(object): """WriterUtilized by context managers.""" @@ -60,7 +64,7 @@ class Writer(object): def __call__(self, s, newline=True, stream=STDOUT): if newline: - s = tsplit(s, ('\n', '\r', '\r\n')) + s = tsplit(s, NEWLINES) indent = ''.join(self.shared['indent_strings']) s = ('\n' + indent).join(s) diff --git a/examples/text_width.py b/examples/text_width.py new file mode 100755 index 0000000..87e2a31 --- /dev/null +++ b/examples/text_width.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +import os + +sys.path.insert(0, os.path.abspath('..')) + +from clint.textui import puts, max_width, min_width + +lorem = 'Lorem ipsum dolor sit amet, consehdfhdfhdfhdfhdfhctetur adi pisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' + +if __name__ == '__main__': + # puts(min_width('test\nit', 20) + ' me') + # puts(min_width(lorem, 20) + ' me') + + print max_width(lorem, 20) \ No newline at end of file From 8b6eb543b9fdbc9421101a5029e89ba62aa99562 Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 08:02:36 -0400 Subject: [PATCH 10/16] textui.clean for stripping colored cli output --- clint/textui/colored.py | 43 +++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/clint/textui/colored.py b/clint/textui/colored.py index f834f75..3f2729c 100644 --- a/clint/textui/colored.py +++ b/clint/textui/colored.py @@ -11,11 +11,14 @@ This module provides a simple and elegant wrapper for colorama. from __future__ import absolute_import +import re +import sys + from ..packages import colorama - -colorama.init(autoreset=True) +if sys.stdout.isatty(): + colorama.init(autoreset=True) __all__ = ( @@ -30,9 +33,16 @@ class ColoredString(object): super(ColoredString, self).__init__() self.s = s self.color = color - self.color_str = '%s%s%s' % ( - getattr(colorama.Fore, self.color), self.s, colorama.Fore.RESET) - + + @property + def color_str(self): + if sys.stdout.isatty(): + return '%s%s%s' % ( + getattr(colorama.Fore, self.color), self.s, colorama.Fore.RESET) + else: + return self.s + + def __len__(self): return len(self.s) @@ -46,17 +56,34 @@ class ColoredString(object): return self.color_str def __add__(self, other): - return str(self.color_str) + str(other) + self.s += other + return self def __radd__(self, other): - return str(other) + str(self.color_str) + self.s = other + self.s + return self def __mul__(self, other): return (self.color_str * other) def split(self, x=' '): - return self.color_str.split(x) +# print map(self._new, self.s.split(x)) + return map(self._new, self.s.split(x)) + + def _new(self, s): + return ColoredString(self.color, s) + + + +def clean(s): + strip = re.compile("([^-_a-zA-Z0-9!@#%&=,/'\";:~`\$\^\*\(\)\+\[\]\.\{\}\|\?\<\>\\]+|[^\s]+)") + txt = strip.sub('', str(s)) + + strip = re.compile(r'\[\d+m') + txt = strip.sub('', txt) + + return txt def black(string): From 52488ace364e2a394ee3d2a7ae49509b68c5c2f7 Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 08:03:24 -0400 Subject: [PATCH 11/16] ColoredString support for width formatters --- clint/textui/formatters.py | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/clint/textui/formatters.py b/clint/textui/formatters.py index e9511e9..4bc2f10 100644 --- a/clint/textui/formatters.py +++ b/clint/textui/formatters.py @@ -10,28 +10,40 @@ Core TextUI functionality for text formatting. from __future__ import absolute_import +from .colored import ColoredString, clean from ..utils import tsplit, schunk NEWLINES = ('\n', '\r', '\r\n') - - def min_width(string, cols, padding=' '): """Returns given string with right padding.""" - stack = tsplit(string, NEWLINES) + is_color = isinstance(string, ColoredString) + + stack = tsplit(str(string), NEWLINES) for i, substring in enumerate(stack): - stack[i] = substring.ljust(cols, padding) + _sub = clean(substring).ljust((cols + 0), padding) + if is_color: + _sub = (_sub.replace(clean(substring), substring)) + stack[i] = _sub return '\n'.join(stack) def max_width(string, cols, separator='\n'): """Returns a freshly formatted """ - + + is_color = isinstance(string, ColoredString) + + if is_color: + offset = 10 + string_copy = string._new('') + else: + offset = 0 + stack = tsplit(string, NEWLINES) for i, substring in enumerate(stack): @@ -44,18 +56,18 @@ def max_width(string, cols, separator='\n'): _row_i = 0 for word in row: - if (len(_row[_row_i]) + len(word)) < cols: + if (len(_row[_row_i]) + len(word)) < (cols + offset): _row[_row_i] += word _row[_row_i] += ' ' - elif len(word) > cols: + elif len(word) > (cols - offset): # ensure empty row if len(_row[_row_i]): _row.append('') _row_i += 1 - chunks = schunk(word, cols) + chunks = schunk(word, (cols + offset)) for i, chunk in enumerate(chunks): if not (i + 1) == len(chunks): _row[_row_i] += chunk @@ -69,7 +81,11 @@ def max_width(string, cols, separator='\n'): _row_i += 1 _row[_row_i] += word _row[_row_i] += ' ' + + _row = map(str, _row) _stack.append(separator.join(_row)) - - return '\n'.join(_stack) + _s = '\n'.join(_stack) + if is_color: + _s = string_copy._new(_s) + return _s From f2fc21755bfb2be7c46a7326d8bc20a8e967d8bc Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 08:03:35 -0400 Subject: [PATCH 12/16] COLUMNS! --- clint/textui/columns.py | 141 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 clint/textui/columns.py diff --git a/clint/textui/columns.py b/clint/textui/columns.py new file mode 100644 index 0000000..84e544c --- /dev/null +++ b/clint/textui/columns.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- + +""" +clint.textui.columns +~~~~~~~~~~~~~~~~~~~~ + +Core TextUI functionality for column formatting. + +""" + +from __future__ import absolute_import + +from .formatters import max_width, min_width +from ..utils import tsplit + +import sys + + +NEWLINES = ('\n', '\r', '\r\n') + + + +def _find_unix_console_width(): + import termios, fcntl, struct, sys + + # fcntl.ioctl will fail if stdout is not a tty + if not sys.stdout.isatty(): + return None + + s = struct.pack("HHHH", 0, 0, 0, 0) + fd_stdout = sys.stdout.fileno() + size = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s) + height, width = struct.unpack("HHHH", size)[:2] + return width + + +def _find_windows_console_width(): + # http://code.activestate.com/recipes/440694/ + from ctypes import windll, create_string_buffer + STDIN, STDOUT, STDERR = -10, -11, -12 + + h = windll.kernel32.GetStdHandle(STDERR) + csbi = create_string_buffer(22) + res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi) + + if res: + import struct + (bufx, bufy, curx, cury, wattr, + left, top, right, bottom, + maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) + sizex = right - left + 1 + sizey = bottom - top + 1 + return sizex + + +def console_width(kwargs): + """"Determine console_width.""" + + if sys.platform.startswith('win'): + console_width = _find_windows_console_width() + else: + console_width = _find_unix_console_width() + + _width = kwargs.get('width', None) + if _width: + console_width = _width + else: + if not console_width: + console_width = 80 + + return console_width + + + +def columns(*cols, **kwargs): + + columns = list(cols) + + cwidth = console_width(kwargs) + + _big_col = None + _total_cols = 0 + + + for i, (string, width) in enumerate(cols): + + if width is not None: + _total_cols += (width + 1) + cols[i][0] = max_width(string, width).split('\n') + else: + _big_col = i + + if _big_col: + cols[_big_col][1] = (cwidth - _total_cols) - len(cols) + cols[_big_col][0] = max_width(cols[_big_col][0], cols[_big_col][1]).split('\n') + + height = len(max([c[0] for c in cols], key=len)) + + for i, (strings, width) in enumerate(cols): + + for _ in range(height - len(strings)): + cols[i][0].append('') + + for j, string in enumerate(strings): + cols[i][0][j] = min_width(string, width) + + stack = [c[0] for c in cols] + _out = [] + + for i in range(height): + _row = '' + + for col in stack: + _row += col[i] + _row += ' ' + + _out.append(_row) +# try: +# pass +# except: +# pass + + + + + return '\n'.join(_out) + + +# string = max_width(string, width) +# string = min_width(string, width) +# pass +# columns.append() + + + +########################### + +a = 'this is text that goes into a small column\n cool?' +b = 'this is other text\nothertext\nothertext' + +#columns((a, 10), (b, 20), (b, None)) From 83bf2288dd3eafe13a15c634e9d399db29db400b Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 08:44:00 -0400 Subject: [PATCH 13/16] text_width example --- examples/text_width.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/text_width.py b/examples/text_width.py index 87e2a31..7b2b0f5 100755 --- a/examples/text_width.py +++ b/examples/text_width.py @@ -6,12 +6,18 @@ import os sys.path.insert(0, os.path.abspath('..')) -from clint.textui import puts, max_width, min_width +from clint.textui import puts, colored +from clint.textui.columns import columns -lorem = 'Lorem ipsum dolor sit amet, consehdfhdfhdfhdfhdfhctetur adi pisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' +lorem = 'Lorem ipsum dolor sit amet, consehdfhdfhdfhdfhdfhctetur adi pisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' if __name__ == '__main__': # puts(min_width('test\nit', 20) + ' me') - # puts(min_width(lorem, 20) + ' me') + # puts(max_width(lorem, 20) + ' me') - print max_width(lorem, 20) \ No newline at end of file + # print max_width(lorem, 45) + + col = 60 + + puts(columns([(colored.red('Column 1')), col], [(colored.green('Column Two')), None], [(colored.magenta('Column III')), col])) + puts(columns(['hi there my name is kenneth and this is a columns', col], [lorem, None], ['kenneths', col])) \ No newline at end of file From 8e021f95e94114fcad8b7756ccc3e11929c90360 Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 13:33:56 -0400 Subject: [PATCH 14/16] join returns colored string (for now) --- clint/textui/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clint/textui/core.py b/clint/textui/core.py index 4300e9d..71c469c 100644 --- a/clint/textui/core.py +++ b/clint/textui/core.py @@ -65,9 +65,10 @@ class Writer(object): if newline: s = tsplit(s, NEWLINES) + s = map(str, s) indent = ''.join(self.shared['indent_strings']) - s = ('\n' + indent).join(s) + s = (str('\n' + indent)).join(s) _str = ''.join(( ''.join(self.shared['indent_strings']), From b576ccbaae3c5dfab3fefcf1ddea9fe2196404f9 Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 13:56:23 -0400 Subject: [PATCH 15/16] disable colors, clean available externally. --- clint/textui/colored.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/clint/textui/colored.py b/clint/textui/colored.py index 3f2729c..ca217cb 100644 --- a/clint/textui/colored.py +++ b/clint/textui/colored.py @@ -16,6 +16,7 @@ import sys from ..packages import colorama +DISABLE_COLOR = False if sys.stdout.isatty(): colorama.init(autoreset=True) @@ -23,7 +24,8 @@ if sys.stdout.isatty(): __all__ = ( 'red', 'green', 'yellow', 'blue', - 'black', 'magenta', 'cyan', 'white' + 'black', 'magenta', 'cyan', 'white', + 'clean', 'disable' ) @@ -36,7 +38,7 @@ class ColoredString(object): @property def color_str(self): - if sys.stdout.isatty(): + if sys.stdout.isatty() and not DISABLE_COLOR: return '%s%s%s' % ( getattr(colorama.Fore, self.color), self.s, colorama.Fore.RESET) else: @@ -67,15 +69,12 @@ class ColoredString(object): return (self.color_str * other) def split(self, x=' '): - -# print map(self._new, self.s.split(x)) return map(self._new, self.s.split(x)) def _new(self, s): return ColoredString(self.color, s) - def clean(s): strip = re.compile("([^-_a-zA-Z0-9!@#%&=,/'\";:~`\$\^\*\(\)\+\[\]\.\{\}\|\?\<\>\\]+|[^\s]+)") txt = strip.sub('', str(s)) @@ -109,3 +108,9 @@ def cyan(string): def white(string): return ColoredString('WHITE', string) + +def disable(): + """Disables colors.""" + global DISABLE_COLOR + + DISABLE_COLOR = True From 2f6e9cbfaad2f79831a0b454543094af4fb6cbf9 Mon Sep 17 00:00:00 2001 From: "star:Kenneth Reitz" Date: Tue, 22 Mar 2011 14:07:34 -0400 Subject: [PATCH 16/16] added args.starts_with for flag catcher --- clint/arguments.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/clint/arguments.py b/clint/arguments.py index 76d643e..579a2e0 100644 --- a/clint/arguments.py +++ b/clint/arguments.py @@ -181,6 +181,25 @@ class Args(object): else: return _find(x) + + def start_with(self, x): + """Returns all arguments beginning with given string (or list thereof)""" + + _args = [] + + for arg in self.all: + if is_collection(x): + for _x in x: + if arg.startswith(x): + _args.append(arg) + break + else: + if arg.startswith(x): + _args.append(arg) + + return Args(_args, no_argv=True) + + def contains_at(self, x, index): """Tests if given [list of] string is at given index.""" @@ -305,7 +324,7 @@ class Args(object): def flags(self): """Returns Arg object including only flagged arguments.""" - return self.all_with('-') + return self.start_with('-') @property