Skip to content

Implement utility that generates a file tree from a path pattern #767

Closed
@tegefaulkes

Description

@tegefaulkes

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.

  1. 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.

  1. Can take either a normal path dir/file, wildcard, dir*/* or globed dir*/**/*.ext paths.
  2. It will need to convert these paths into one or more paths by walking the file tree matching the supplied path.
  3. 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.
  4. 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

  1. Implement a file system walker that will walk a file tree based on a provided path pattern.
  2. It needs to support simple paths, wildcards and globs.
  3. It needs to output them as a generator.
  4. It needs to output paths in the order they are walked.
  5. It needs an option to output parent directories of paths.
  6. It needs to suport the fs interface to allow use with nodes FS or our EFS.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions