tree find opt: dont_show_children_nodes
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user