Skip to content

Commit

Permalink
Merge pull request #30 from anc95/fix-arrow
Browse files Browse the repository at this point in the history
fix: arrow display & validate the filtered value #28 #29
  • Loading branch information
anc95 committed Jun 28, 2021
2 parents a1e73c9 + f0f318d commit c98fa46
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [1.0.8](https://github.com/anc95/inquirer-file-tree-selection/compare/v1.0.7...1.0.8)

> 28 June 2021
- Remove unused dependency 'directory-tree' [`#26`](https://github.com/anc95/inquirer-file-tree-selection/pull/26)
- Fix keyword typo [`#27`](https://github.com/anc95/inquirer-file-tree-selection/pull/27)
- chore(deps): bump lodash from 4.17.19 to 4.17.21 [`#24`](https://github.com/anc95/inquirer-file-tree-selection/pull/24)
- feat: use left and right keys to navigate folders [`#22`](https://github.com/anc95/inquirer-file-tree-selection/pull/22)
- fix: arrow display & validate the filtered value #28 #29 [`7320a94`](https://github.com/anc95/inquirer-file-tree-selection/commit/7320a942fae9cd61600ccde0425d138fdbe506c1)
- ci: changelog [`ad975c7`](https://github.com/anc95/inquirer-file-tree-selection/commit/ad975c7c13fbce054a30e07ef4e2689282d31b5a)
- Remove directory-tree [`5f93d58`](https://github.com/anc95/inquirer-file-tree-selection/commit/5f93d58a25f26376b8cae5fb7c482fe65dfc0cf7)

#### [v1.0.7](https://github.com/anc95/inquirer-file-tree-selection/compare/v1.0.6...v1.0.7)

> 10 October 2020
Expand Down
12 changes: 10 additions & 2 deletions index.js
Expand Up @@ -133,7 +133,7 @@ class FileTreeSelectionPrompt extends Base {
}

this.shownList.push(itemPath)
let prefix = itemPath.children
let prefix = itemPath.type === 'directory'
? itemPath.open
? figures.arrowDown + ' '
: figures.arrowRight + ' '
Expand Down Expand Up @@ -198,9 +198,17 @@ class FileTreeSelectionPrompt extends Base {
}

const validate = this.opt.validate;
const filter = async val => {
if (!this.opt.filter) {
return val;
}

return await this.opt.filter(val);
};

if (validate) {
const addValidity = async (fileObj) => {
const isValid = await validate(fileObj.path);
const isValid = await validate(await filter(fileObj.path), this.answers);
fileObj.isValid = false;
if (isValid === true) {
if (this.opt.onlyShowDir) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "inquirer-file-tree-selection-prompt",
"version": "1.0.7",
"version": "1.0.8",
"repository": "https://github.com/anc95/inquirer-file-tree-selection",
"description": "inquerer file tree selection prompt",
"main": "index.js",
Expand Down

0 comments on commit c98fa46

Please sign in to comment.