mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Fixed linting issues
This commit is contained in:
parent
76ba630d59
commit
ac18b74e66
1 changed files with 21 additions and 28 deletions
|
@ -46,53 +46,46 @@ class FileTree extends Operation {
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
|
|
||||||
// Set up arrow and pipe for nice output display
|
// Set up arrow and pipe for nice output display
|
||||||
const ARROW = '|---';
|
const ARROW = "|---";
|
||||||
const PIPE = '| ';
|
const PIPE = "| ";
|
||||||
|
|
||||||
// Get args from input
|
// Get args from input
|
||||||
const file_delim = args[0];
|
const fileDelim = args[0];
|
||||||
const entry_delim = Utils.charRep(args[1]);
|
const entryDelim = Utils.charRep(args[1]);
|
||||||
|
|
||||||
// Store path to print
|
// Store path to print
|
||||||
let completed_list = [];
|
const completedList = [];
|
||||||
let print_list = [];
|
const printList = [];
|
||||||
|
|
||||||
// Loop through all entries
|
// Loop through all entries
|
||||||
const file_paths = input.split(entry_delim).unique().sort();
|
const filePaths = input.split(entryDelim).unique().sort();
|
||||||
for (var i = 0; i < file_paths.length; i++)
|
for (let i = 0; i < filePaths.length; i++) {
|
||||||
{
|
|
||||||
// Split by file delimiter
|
// Split by file delimiter
|
||||||
let path = file_paths[i].split(file_delim);
|
let path = filePaths[i].split(fileDelim);
|
||||||
|
|
||||||
if (path[0] == '')
|
if (path[0] === "") {
|
||||||
{
|
|
||||||
path = path.slice(1, path.length);
|
path = path.slice(1, path.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = 0; j < path.length; j++)
|
for (let j = 0; j < path.length; j++) {
|
||||||
{
|
let printLine;
|
||||||
let print_line;
|
|
||||||
let key;
|
let key;
|
||||||
if (j == 0)
|
if (j === 0) {
|
||||||
{
|
printLine = path[j];
|
||||||
print_line = path[j];
|
|
||||||
key = path[j];
|
key = path[j];
|
||||||
}
|
} else {
|
||||||
else
|
printLine = PIPE.repeat(j-1) + ARROW + path[j];
|
||||||
{
|
|
||||||
print_line = PIPE.repeat(j-1) + ARROW + path[j]
|
|
||||||
key = path.slice(0, j+1).join("/");
|
key = path.slice(0, j+1).join("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see we have already added that path
|
// Check to see we have already added that path
|
||||||
if (!completed_list.includes(key))
|
if (!completedList.includes(key)) {
|
||||||
{
|
completedList.push(key);
|
||||||
completed_list.push(key);
|
printList.push(printLine);
|
||||||
print_list.push(print_line);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return print_list.join("\n");
|
return printList.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue