guide to command
This commit is contained in:
parent
f16897721f
commit
3a1d340f2d
36
README.md
36
README.md
|
@ -1,5 +1,33 @@
|
|||
# Nerd tree
|
||||
# Visual Find
|
||||
|
||||
**vfind** is a tool written in python based on *nerd_tree*.<br />
|
||||
Its purpose (and base idea) is to blend the unix command *find* with the *tree* command.<br />
|
||||
You can search in a particular subtree for files or folders that match a regular expression and other criteria, the results will be shown graphically in a tree (in a similar way that the tree command does).<br />
|
||||
|
||||
## Installation on your system
|
||||
|
||||
In my opinion the better solution is:<br />
|
||||
1. Clone the repository in your home folder
|
||||
2. Go to your home folder and make a symbolic link to the command, in your ~/bin folder
|
||||
```
|
||||
cd ~/nerd_tree
|
||||
ln -s ~/nerd_tree/vfind.py ~/bin/vfind
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
**vfind** has 2 mandatory arguments, the *path* of subtree from which to begin the search and the *search* pattern (a regexp)
|
||||
|
||||
```
|
||||
vfind ~/nerd_tree/ "(.*)rem(.*)"
|
||||
```
|
||||
|
||||
all items matching the pattern are show in the result tree.<br />
|
||||
The folder matching the pattern are show with information about the total number of files and the size of the subtree.
|
||||
If you want to show the subtree expanded you can use the flag **-s**
|
||||
|
||||
```
|
||||
vfind ~/nerd_tree/ "(.*)rem(.*)" -s
|
||||
```
|
||||
|
||||
|
||||
An ugly version of the unix-like tree command and a visual version of find command that shows the results found in a visual tree.
|
||||
All written in python language.
|
||||
Branch is unstable and under development
|
||||
|
|
|
@ -29,8 +29,6 @@ class NerdTreeFind(NerdTree):
|
|||
return all([test_match, test_type])
|
||||
|
||||
def find_node_recursively(self, node):
|
||||
# if node['name'] == self.item_name:
|
||||
# if self.re_item_name.match(node['name']):
|
||||
if self.found_true_cond(node):
|
||||
node_copy = node.copy()
|
||||
node_copy.update({'color_formatter' : YELLOW, 'found' : 1})
|
||||
|
@ -42,8 +40,6 @@ class NerdTreeFind(NerdTree):
|
|||
if item_child['type'] == 'd':
|
||||
self.find_node_recursively(item_child)
|
||||
else:
|
||||
# if item_child['name'] == self.item_name:
|
||||
# if self.re_item_name.match(item_child['name']):
|
||||
if self.found_true_cond(item_child):
|
||||
item_child_copy = item_child.copy()
|
||||
item_child_copy.update({'color_formatter' : YELLOW, 'found' : 1})
|
||||
|
@ -77,6 +73,7 @@ class NerdTreeFind(NerdTree):
|
|||
|
||||
def find_tree_struct(self):
|
||||
'''
|
||||
recreates the tree with search results
|
||||
'''
|
||||
results = self.find_node()
|
||||
|
||||
|
@ -85,11 +82,6 @@ class NerdTreeFind(NerdTree):
|
|||
if not results:
|
||||
return {}
|
||||
|
||||
# if dont_show_children_nodes:
|
||||
# for result in results:
|
||||
# children = result.get('children') or []
|
||||
# result['nchildren'] = len(children)
|
||||
# result['children'] = []
|
||||
dont_show_children_nodes = self.find_opts['dont_show_children_nodes'] if self.find_opts.get('dont_show_children_nodes') is not None else False
|
||||
self.opts['dont_show_children_nodes'] = dont_show_children_nodes
|
||||
|
||||
|
|
Loading…
Reference in New Issue