Closed
Description
Specification
There are some common problems to solve to the new unix commands being developed in MatrixAI/Polykey-CLI#32. One main one being the ability to get a filetree based on a file path pattern using wildcards or globing.
- A utility for walking a file tree based in a wildcard or glob pattern. So it needs to translate
dir*/*
or**/dir*/*.ext
paths into a full file tree of directories and files that match that path.
The filesystem walker needs to support the following.
- Can take either a normal path
dir/file
, wildcard,dir*/*
or globeddir*/**/*.ext
paths. - It will need to convert these paths into one or more paths by walking the file tree matching the supplied path.
- For our uses, it needs to output every parent directory as well. So for a globed
**/*.ext
it needs to output every parent directory path in that tree as well. We can add a switch to toggle this. - It needs to work with both the node fs and efs interface.
Most of the commands we need to implement support some level of wildcard or globing. So this is essential to supporting that.
Additional context
Related MatrixAI/Polykey-CLI#32
Tasks
- Implement a file system walker that will walk a file tree based on a provided path pattern.
- It needs to support simple paths, wildcards and globs.
- It needs to output them as a generator.
- It needs to output paths in the order they are walked.
- It needs an option to output parent directories of paths.
- It needs to suport the fs interface to allow use with nodes FS or our EFS.