anc95 / inquirer-file-tree-selection

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

The option "default" does not take effect #39

Closed rcjiang closed 2 years ago

rcjiang commented 2 years ago
{
    name: 'folder',
    type: 'inquirer-file-tree-selection',
    message: 'Select a folder:',
    onlyShowDir: true,
   // expect to display the default value, or it is selected in the list
   // the folder already exists, try to use path.resolve('./src') but it’s still doesn't work
    default: './src'  
}
anc95 commented 2 years ago

@rcjiang What do you mean, I just can't get, can you describe more info about this

rcjiang commented 2 years ago

@anc95

  1. My options:

    {
        name: 'folder',
        type: 'inquirer-file-tree-selection',
        message: 'Select a folder:',
        onlyShowDir: true,
        default: './src'  
    }

    The default option was added and configured as './src', I expect the next step it should be selected by default(show highlighted):
    image

  2. The actual result is:the default seleted is the first folder not "./src" image

Essentially, this issue is the same as:#25

anc95 commented 2 years ago

@rcjiang I totally understood what do you mean, I will work this today and implement default the same behavior as inquirejs's internal prompt. Give me some time, I will notify you here when new version is released. Thx for your feedback.

anc95 commented 2 years ago

@rcjiang Good news, I just release 1.0.15 to support this feature, readme updated for usage of default, and I added a demo https://github.com/anc95/inquirer-file-tree-selection/blob/main/example/default.js, you can go to see how to use.