Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The option "default" does not take effect #39

Closed
rcjiang opened this issue Jan 2, 2022 · 4 comments
Closed

The option "default" does not take effect #39

rcjiang opened this issue Jan 2, 2022 · 4 comments
Labels
good first issue Good for newcomers

Comments

@rcjiang
Copy link

rcjiang commented Jan 2, 2022

{
    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
Copy link
Owner

anc95 commented Jan 16, 2022

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

@anc95 anc95 added the good first issue Good for newcomers label Jan 16, 2022
@rcjiang
Copy link
Author

rcjiang commented Jan 17, 2022

@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
Copy link
Owner

anc95 commented Jan 17, 2022

@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
Copy link
Owner

anc95 commented Jan 17, 2022

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

@rcjiang rcjiang closed this as completed Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants