mirror of
https://github.com/kennethreitz/clint.git
synced 2026-06-05 23:00:18 +00:00
added flags, not_flags, files, not_files
This commit is contained in:
+21
-8
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user