Compare commits
No commits in common. "41113119cc5d192539038c092190625fa04058d7" and "c16788d90b8e054f964c2c5d7280c4c53683c870" have entirely different histories.
41113119cc
...
c16788d90b
|
@ -1 +0,0 @@
|
|||
**/__pycache__
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -11,8 +11,6 @@ cmd_parser.add_argument("path")
|
|||
cmd_parser.add_argument("pattern")
|
||||
# if -s is found in the command line cmd_args.show_children_nodes is True
|
||||
cmd_parser.add_argument("-s", "--show-children-nodes", action="store_true")
|
||||
## more than one occurrencies of -e option are appended in a list
|
||||
cmd_parser.add_argument("-e", "--exclude", action="append")
|
||||
|
||||
# start the command line parsing
|
||||
cmd_args = cmd_parser.parse_args()
|
||||
|
|
|
@ -114,7 +114,7 @@ class NerdTree():
|
|||
d.setdefault('not_readable', 1)
|
||||
|
||||
for item in items:
|
||||
if item in self.opts.get('items_to_exclude') or []:
|
||||
if item in _tree_repr.ITEMS_TO_EXCLUDE:
|
||||
continue
|
||||
|
||||
abs_path_item = startpath+item
|
||||
|
@ -205,8 +205,8 @@ class NerdTree():
|
|||
items = rootnode.get('children') or []
|
||||
|
||||
for n, item in enumerate(items):
|
||||
# if item['name'] in _tree_repr.ITEMS_TO_EXCLUDE:
|
||||
# continue
|
||||
if item['name'] in _tree_repr.ITEMS_TO_EXCLUDE:
|
||||
continue
|
||||
|
||||
islast = (n==len(items) -1)
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ CHILD_CONNECTOR = '├── '
|
|||
LAST_CHILD_CONNECTOR = '└── '
|
||||
### is the length of child connector and last_child_connector
|
||||
LEVEL_INDENT = 4
|
||||
# ITEMS_TO_EXCLUDE = ['__pycache__']
|
||||
ITEMS_TO_EXCLUDE = []
|
||||
ITEMS_TO_EXCLUDE = ['__pycache__']
|
||||
|
||||
KB = 1024
|
||||
MB = 1024*1024
|
||||
|
@ -52,19 +51,19 @@ def produce_treeline(prec_seps, lsep):
|
|||
return tree_line.rstrip()
|
||||
|
||||
def format(num, unit=None):
|
||||
if num/GB >=1 or unit == 'G':
|
||||
unit = 'G'
|
||||
human_number = round(num/GB, 2)
|
||||
elif num/MB >=1 or unit == 'M':
|
||||
unit = 'M'
|
||||
human_number = round(num/MB, 2)
|
||||
elif num/KB >=1 or unit == 'K':
|
||||
unit = 'K'
|
||||
human_number = round(num/KB, 2)
|
||||
else:
|
||||
unit = 'B'
|
||||
human_number = num
|
||||
# unit = 'b'
|
||||
# human_number = num
|
||||
# if num/GB >=1:
|
||||
# unit = 'GB'
|
||||
# human_number = round(num/GB, 2)
|
||||
# elif num/MB >=1:
|
||||
# unit = 'MB'
|
||||
# human_number = round(num/MB, 2)
|
||||
# elif num/KB >=1:
|
||||
# unit = 'kB'
|
||||
# human_number = round(num/KB, 2)
|
||||
# else:
|
||||
# unit = 'b'
|
||||
# human_number = num
|
||||
unit = 'b'
|
||||
human_number = num
|
||||
|
||||
return human_number, unit
|
||||
|
|
8
vfind.py
8
vfind.py
|
@ -10,15 +10,9 @@ if __name__ == '__main__':
|
|||
pattern = cmd_args.pattern
|
||||
show_children_nodes = cmd_args.show_children_nodes
|
||||
|
||||
# opts for generatign the tree
|
||||
opts = {
|
||||
'items_to_exclude' : cmd_args.exclude or [],
|
||||
}
|
||||
|
||||
# opts for find
|
||||
find_opts = {
|
||||
'dont_show_children_nodes': not show_children_nodes
|
||||
}
|
||||
|
||||
ntree = NerdTreeFind(path, opts=opts)
|
||||
ntree = NerdTreeFind(path)
|
||||
ntree.find(pattern, opts=find_opts)
|
||||
|
|
Loading…
Reference in New Issue