mirror of
https://github.com/kennethreitz/clint.git
synced 2026-06-05 23:00:18 +00:00
fix for found arg at pos 0
This commit is contained in:
+11
-12
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user