@krishna_g_k/my--cli
Version:
Quickly organize,tree view A Directory
47 lines • 1.44 kB
JavaScript
const inquirer = require('inquirer');
const main=require('./main');
let helpFunc=require('./commands/help.js');
let organizepublic=require('./commands/organize');
let tree = require('./commands/tree');
inquirer
.prompt([
/* Pass your questions in here */
{type: 'list',message:"pick the command you want to use:", name: "command", choices: [
'organize',
'tree',
'help'
] }
])
.then((answers) => {
// Use user feedback for... whatever!!
// console.log(answers);
if(answers.command=='help'){
helpFunc.help();
}else if(answers.command=='organize'){
inquirer
.prompt([
/* Pass your questions in here */
{type: 'default',message:"Enter the path of Directory:", name: "Dirpath" }
])
.then((answers) => {
organizepublic.organizepublic(answers.Dirpath);
})
}else if(answers.command == 'tree') {
inquirer
.prompt([
/* Pass your questions in here */
{type: 'default',message:"Enter the path of Directory:", name: "Dirpath" }
])
.then((answers) => {
tree.tree(answers.Dirpath);
})
}
})
.catch((error) => {
if (error.isTtyError) {
// Prompt couldn't be rendered in the current environment
} else {
// Something else went wrong
}
});