tree find opt: dont_show_children_nodes
This commit is contained in:
parent
eea94fd4aa
commit
6e3ea51aaa
Binary file not shown.
|
@ -234,13 +234,20 @@ def find_children(tree, item_abs_path):
|
||||||
|
|
||||||
return (False, [])
|
return (False, [])
|
||||||
|
|
||||||
def find_tree_struct(startpath, item_name):
|
def find_tree_struct(startpath, item_name, opts={}):
|
||||||
'''
|
'''
|
||||||
'''
|
'''
|
||||||
results = find_node(startpath, item_name)
|
results = find_node(startpath, item_name)
|
||||||
|
|
||||||
|
dont_show_children_nodes = True if opts.get('dont_show_children_nodes') else False
|
||||||
|
|
||||||
if not results:
|
if not results:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
if dont_show_children_nodes:
|
||||||
|
for result in results:
|
||||||
|
result['children'] = []
|
||||||
|
|
||||||
tree_struct = {}
|
tree_struct = {}
|
||||||
|
|
||||||
for node in results:
|
for node in results:
|
||||||
|
@ -277,8 +284,8 @@ def nerd_tree(startpath):
|
||||||
tree_txt = nerd_tree_from_struct(tree_struct)
|
tree_txt = nerd_tree_from_struct(tree_struct)
|
||||||
print(tree_txt)
|
print(tree_txt)
|
||||||
|
|
||||||
def find_nerd_tree(startpath, item_name):
|
def find_nerd_tree(startpath, item_name, opts={}):
|
||||||
tree_struct = find_tree_struct(startpath, item_name)
|
tree_struct = find_tree_struct(startpath, item_name, opts=opts)
|
||||||
if not tree_struct:
|
if not tree_struct:
|
||||||
print('No results')
|
print('No results')
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue