New function: getUserTopLevelCategories and getAllNoAutoLinks

parent 7fa9b98e
/* This file is part of Vitis.
*
* Copyright (C) 2018-2019 Eugene 'Vindex' Stulin
* Copyright (C) 2018-2020 Eugene 'Vindex' Stulin
*
* Vitis is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -372,6 +372,22 @@ string[] getTopLevelCategories(Flag!"fullPath" fullPath = Yes.fullPath) {
return categories;
}
string[] getUserTopLevelCategories(Flag!"fullPath" fullPath = Yes.fullPath) {
string[] usercategories = amalthea.fs.getDirList(getVitisPath)
.filter!(a => !a.canFind("/__") && a.isDir)
.filter!(a => !a.isSymlink)
.array;
if (!fullPath) {
size_t l = getVitisPath().length;
foreach(ref cat; usercategories) {
cat = cat[l .. $];
}
}
return usercategories;
}
string[] getTopLevelCategoriesAndAliases(
Flag!"fullPath" fullPath = Yes.fullPath
) {
......@@ -583,6 +599,16 @@ string[string] getAllLinks() {
return allLinks;
}
string[string] getAllNoAutoLinks() {
string[] allTopCategories = getUserTopLevelCategories();
string[string] allLinks;
foreach(category; allTopCategories) {
auto temp = amalthea.fs.getSymlinksInfo(category); //recursively
foreach(k, v; temp) allLinks[k] = v;
}
return allLinks;
}
string[string] getAllLinksFromCache() {
static bool firstFunctionCall = true;
......@@ -750,7 +776,7 @@ string getBorder() {
/*******************************************************************************
* Interactive element of UI: getting an answer (yes/no) to a question
*/
bool getAnswerToTheQuestion(string question) {
bool getAnswerToTheQuestion(string question = "") {
"simple".tprint(question);
string ans = readln;
ans = std.string.strip(ans).toLower;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment