diff --git a/src/__pycache__/tree_repr.cpython-39.pyc b/src/__pycache__/tree_repr.cpython-39.pyc index 524222b..cff5158 100644 Binary files a/src/__pycache__/tree_repr.cpython-39.pyc and b/src/__pycache__/tree_repr.cpython-39.pyc differ diff --git a/src/tree_repr.py b/src/tree_repr.py index 7ee1d90..4fa04b8 100644 --- a/src/tree_repr.py +++ b/src/tree_repr.py @@ -234,13 +234,20 @@ def find_children(tree, item_abs_path): return (False, []) -def find_tree_struct(startpath, item_name): +def find_tree_struct(startpath, item_name, opts={}): ''' ''' results = find_node(startpath, item_name) + + dont_show_children_nodes = True if opts.get('dont_show_children_nodes') else False + if not results: return {} + if dont_show_children_nodes: + for result in results: + result['children'] = [] + tree_struct = {} for node in results: @@ -277,8 +284,8 @@ def nerd_tree(startpath): tree_txt = nerd_tree_from_struct(tree_struct) print(tree_txt) -def find_nerd_tree(startpath, item_name): - tree_struct = find_tree_struct(startpath, item_name) +def find_nerd_tree(startpath, item_name, opts={}): + tree_struct = find_tree_struct(startpath, item_name, opts=opts) if not tree_struct: print('No results') return