inquirer-file-tree-selection-prompt
Version:
inquerer file tree selection prompt
19 lines (18 loc) • 459 B
JavaScript
import path from 'path';
const getParentDir = (dir) => {
return path.dirname(dir);
};
export const getUpperDirNode = (dir) => {
const parentDir = getParentDir(dir);
const parentNode = {
name: '..',
path: parentDir,
type: 'directory',
isValid: true
};
return parentNode;
};
export const gotoUpperDir = (upperDir, currentRootNode) => {
currentRootNode._rootNode = false;
upperDir._rootNode = true;
};