nerd_tree/vfind.py

37 lines
1019 B
Python
Raw Normal View History

2024-01-29 14:07:09 +01:00
#!/usr/bin/env python
from src.cmdline_parser import cmd_args
from src.tree_find import NerdTreeFind
if __name__ == '__main__':
2024-03-12 11:41:29 +01:00
# print(cmd_args.path)
# print(cmd_args.show_children_nodes)
# print(cmd_args.show_father_subtree_info)
2024-01-29 14:07:09 +01:00
path = cmd_args.path
pattern = cmd_args.pattern
show_children_nodes = cmd_args.show_children_nodes
2024-03-12 11:41:29 +01:00
show_subtree_info = cmd_args.show_subtree_info
use_re = cmd_args.regular_expression
2024-01-29 14:07:09 +01:00
2024-01-31 12:02:13 +01:00
# opts for generatign the tree
opts = {
'items_to_exclude' : cmd_args.exclude or [],
2024-04-17 16:54:54 +02:00
'follow_symbolic_link': True,
2024-01-31 12:02:13 +01:00
}
2024-03-12 11:41:29 +01:00
if show_subtree_info:
## force show_children_nodes -> True
show_children_nodes = True
2024-01-31 12:02:13 +01:00
# opts for find
2024-01-29 14:07:09 +01:00
find_opts = {
2024-02-05 10:10:00 +01:00
'dont_show_children_nodes': not show_children_nodes,
2024-03-12 11:41:29 +01:00
'show_subtree_info': show_subtree_info,
2024-02-05 10:10:00 +01:00
'type' : cmd_args.type,
2024-02-22 09:40:24 +01:00
'items_to_include' : cmd_args.include or [],
'use_regular_expression' : use_re,
2024-01-29 14:07:09 +01:00
}
2024-01-31 12:02:13 +01:00
ntree = NerdTreeFind(path, opts=opts)
2024-01-29 14:07:09 +01:00
ntree.find(pattern, opts=find_opts)