added flags, not_flags, files, not_files

This commit is contained in:
Kenneth Reitz
2011-03-20 15:38:48 -04:00
parent 81294725e9
commit 82f40e06f9
+21 -8
View File
@@ -301,20 +301,20 @@ class Args(object):
return Args(_args, no_argv=True)
@property
def no_flags(self):
"""Returns Arg object excluding flagged arguments."""
return self.all_without('-')
@property
def only_flags(self):
def flags(self):
"""Returns Arg object including only flagged arguments."""
return self.all_with('-')
@property
def not_flags(self):
"""Returns Arg object excluding flagged arguments."""
return self.all_without('-')
@property
def files(self, absolute=False):
"""Returns an expanded list of all valid paths that were passed in."""
@@ -332,6 +332,19 @@ class Args(object):
return _paths
@property
def not_files(self):
"""Returns a list of all arguments that aren't files/globs."""
_args = []
for arg in self.all:
if not len(_expand_path(arg)):
if not os.path.exists(arg):
_args.append(arg)
return _args
@property
def copy(self):
"""Returns a copy of Args object for temporary manipulation."""