diff options
author | Matthias Baumgartner <dev@igsor.net> | 2023-04-05 17:45:25 +0200 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2023-04-05 17:45:25 +0200 |
commit | aefd0cb4fa1a949beabc51e88a5c46843043a439 (patch) | |
tree | e978249655fcab58f9ee1479c268ca8b06af7e8d /bsie/apps | |
parent | 0b6b1d27756d1c02a2a667ebfc1a119081ff079f (diff) | |
download | bsie-aefd0cb4fa1a949beabc51e88a5c46843043a439.tar.gz bsie-aefd0cb4fa1a949beabc51e88a5c46843043a439.tar.bz2 bsie-aefd0cb4fa1a949beabc51e88a5c46843043a439.zip |
move file walker into its own module
Diffstat (limited to 'bsie/apps')
-rw-r--r-- | bsie/apps/index.py | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/bsie/apps/index.py b/bsie/apps/index.py index ef467bd..7dda6f4 100644 --- a/bsie/apps/index.py +++ b/bsie/apps/index.py @@ -6,7 +6,7 @@ import typing # bsie imports from bsie.lib import BSIE, DefaultNamingPolicy -from bsie.utils import bsfs, errors, node as node_ +from bsie.utils import bsfs, errors, node as node_, list_files # inner-module imports from . import _loader @@ -59,22 +59,9 @@ def main(argv): # FIXME: simplify code (below but maybe also above) # FIXME: How to handle dependencies between data? # E.g. do I still want to link to a tag despite not being permitted to set its label? - - # index input paths - for path in args.input_file: - if not os.path.exists(path): - pass # FIXME: notify the user - elif os.path.isdir(path) and args.recursive: - for dirpath, _, filenames in os.walk(path, topdown=True, followlinks=args.follow): - for filename in filenames: - for node, pred, value in bsie.from_file(os.path.join(dirpath, filename)): - handle(node, pred, value) - elif os.path.isfile(path): - for node, pred, value in bsie.from_file(path): - handle(node, pred, value) - else: - raise errors.UnreachableError() - + for path in list_files(args.input_file, args.recursive, args.follow): + for node, pred, value in bsie.from_file(path): + handle(node, pred, value) if args.print: walk(print) |