From 34fb8d4894521e9cb979f7ea1f1cefe3be8c782c Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Sat, 22 Oct 2022 13:35:50 +0200 Subject: [PATCH] logs and comments --- catcli/catcli.py | 5 ++++- catcli/noder.py | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/catcli/catcli.py b/catcli/catcli.py index e6a3e7b..661877d 100755 --- a/catcli/catcli.py +++ b/catcli/catcli.py @@ -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)') diff --git a/catcli/noder.py b/catcli/noder.py index 86da245..b3d4c3f 100644 --- a/catcli/noder.py +++ b/catcli/noder.py @@ -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: