mirror of
https://github.com/LukeHagar/VA-Log-Parser.git
synced 2025-12-07 21:07:46 +00:00
Update startCLI.js
This commit is contained in:
@@ -3,6 +3,12 @@ import boxen from "boxen";
|
|||||||
import ora from "ora";
|
import ora from "ora";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import parseLogFile from "./parseLogFile.js";
|
import parseLogFile from "./parseLogFile.js";
|
||||||
|
import chalk from "chalk";
|
||||||
|
|
||||||
|
function checkDirectory(path) {
|
||||||
|
const stats = fs.statSync(path);
|
||||||
|
return stats.isDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
export default function startCLI() {
|
export default function startCLI() {
|
||||||
const spinner = ora();
|
const spinner = ora();
|
||||||
@@ -25,7 +31,12 @@ export default function startCLI() {
|
|||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
message: "Select Log Files to Parse",
|
message: "Select Log Files to Parse",
|
||||||
name: "Files",
|
name: "Files",
|
||||||
choices: directoryContents,
|
choices: [
|
||||||
|
new inquirer.Separator(chalk.yellow("------Folders------")),
|
||||||
|
...directoryContents.filter((Obj) => checkDirectory(Obj) === true),
|
||||||
|
new inquirer.Separator(chalk.green("------Files------")),
|
||||||
|
...directoryContents.filter((Obj) => checkDirectory(Obj) === false),
|
||||||
|
],
|
||||||
validate(answer) {
|
validate(answer) {
|
||||||
if (answer.length < 1) {
|
if (answer.length < 1) {
|
||||||
return "You must choose at least one File.";
|
return "You must choose at least one File.";
|
||||||
|
|||||||
Reference in New Issue
Block a user