anc95 / inquirer-file-tree-selection

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

Split the question type and the application #14

Open curry684 opened 4 years ago

curry684 commented 4 years ago

Given that this is the only inquirer plugin afaics that provides a tree based question - how about splitting it up in 2 packages inquirer-tree-selection and on top of that a thin layer for the filesystem?

There are many more applications of trees than just filesystems.

anc95 commented 4 years ago

@curry684 thx for your nice advice I guess sometimes using cascade may work better than tree selection. but it will be greatly appreciated if you can provide me some situation when you what to use a tree selection in terminal.

curry684 commented 4 years ago

My use case is quite specific, I have a bunch of nested objects which can all be selected (leaves and nodes). Given a simple tree like this:

Root #1
    Child #1
        Subchild #1
    Child #2
Root #2
    Child #3
    Child #4
        Subchild #2

Selecting a target here is just more practical to present in a tree than with up to 3 consecutive questions, especially given that the user may not know beforehand where Subchild #2 resides in my case.

anc95 commented 4 years ago

ok, I WILL wrok on it soon.

curry684 commented 4 years ago

That would be awesome :) It was just a suggestion because it seems you've already done all the hard work on showing a tree, splitting it out to have the file tree just as a "data source" to a generic tree handler shouldn't be hard methinks 😄