diff --git a/catcli/catcli.py b/catcli/catcli.py index e486e17..0655c62 100755 --- a/catcli/catcli.py +++ b/catcli/catcli.py @@ -193,7 +193,7 @@ def cmd_find(args, noder, top): script = args['--script'] search_for = args[''] return noder.find_name(top, search_for, script=script, - startpath=startpath, directory=directory, + startpath=startpath, only_dir=directory, parentfromtree=fromtree, fmt=fmt, raw=raw) diff --git a/catcli/noder.py b/catcli/noder.py index ff629f0..3fbec08 100644 --- a/catcli/noder.py +++ b/catcli/noder.py @@ -515,7 +515,7 @@ class Noder: # searching ############################################################### def find_name(self, top, key, - script=False, directory=False, + script=False, only_dir=False, startpath=None, parentfromtree=False, fmt='native', raw=False): """ @@ -536,7 +536,7 @@ class Noder: start = top if startpath: start = self.get_node(top, startpath) - filterfunc = self._callback_find_name(key, directory) + filterfunc = self._callback_find_name(key, only_dir) found = anytree.findall(start, filter_=filterfunc) nbfound = len(found) self._debug(f'found {nbfound} node(s)') @@ -584,7 +584,7 @@ class Noder: return list(paths.values()) - def _callback_find_name(self, term, directory): + def _callback_find_name(self, term, only_dir): """callback for finding files""" def find_name(node): if node.type == self.TYPE_STORAGE: @@ -596,7 +596,7 @@ class Noder: if node.type == self.TYPE_META: # ignore meta nodes return False - if directory and node.type != self.TYPE_DIR: + if only_dir and node.type != self.TYPE_DIR: # ignore non directory return False