anc95 / inquirer-file-tree-selection

inquirer prompt for select a file or dir by file tree
49 stars 26 forks source link

Suggestion: add `fs` option to question, for substituting other filesystem implementations #92

Open ajvincent opened 1 year ago

ajvincent commented 1 year ago

I'm writing a configuration wizard using this project, along with memfs and unionfs to manage a temporary file system as an overlay on top of the existing real file system. I really would like to pass in the temporary file system I built from unionfs as an override.

There are precisely two uses of fs in src/index/index.ts. This could be a pretty straight-forward fix.

On a related note, I did some experiments with enquirer a couple days ago. I was running prompts through a child process and driving it through stdin and stdout. The goal was to add automated tests. I see no reason I couldn't do the same here, if there's a desire for it. I just need to know what testing framework you'd prefer.

anc95 commented 1 year ago

@ajvincent Sorry for the late reply.

For the first one, sure, we can add a fs config, so the user can pass their custom fs such as memfs.

The second one, I am very interested in the automated tool you are working on, I think it's helpful for some terminal-related tools testing, I prefer jest and vitest for the test job. Looking forward to your update about the automated test tool.