logs and comments

pull/29/head
deadc0de6 2 years ago
parent b3101a1dfa
commit 34fb8d4894

@ -146,11 +146,14 @@ def cmd_ls(args, noder, top):
path = SEPARATOR
if not path.startswith(SEPARATOR):
path = SEPARATOR + path
# prepend with top node path
pre = f'{SEPARATOR}{noder.TOPNAME}'
if not path.startswith(pre):
path = pre + path
# ensure ends with a separator
if not path.endswith(SEPARATOR):
path += SEPARATOR
# add wild card
if not path.endswith(WILD):
path += WILD
@ -262,7 +265,7 @@ def print_supported_formats():
"""print all supported formats to stdout"""
print('"native" : native format')
print('"csv" : CSV format')
print(f' {Noder.CSV_HEADER}')
print(f' {Noder.CSV_HEADER}')
print('"fzf-native" : fzf to native (only for find)')
print('"fzf-csv" : fzf to csv (only for find)')

@ -609,16 +609,19 @@ class Noder:
###############################################################
# climbing
###############################################################
def walk(self, top, path, rec=False, fmt='native',
def walk(self, top, path,
rec=False,
fmt='native',
raw=False):
"""
walk the tree for "ls" based on names
@top: start node
@top: top node
@path: path to search for
@rec: recursive walk
@fmt: output format
@raw: print raw size
"""
self._debug(f'walking path: \"{path}\"')
self._debug(f'walking path: \"{path}\" from {top}')
resolv = anytree.resolver.Resolver('name')
found = []
@ -627,6 +630,7 @@ class Noder:
found = resolv.glob(top, path)
if len(found) < 1:
# nothing found
self._debug('nothing found')
return []
if rec:

Loading…
Cancel
Save